1
votes

I am trying to compile the Win32 Example of the Parrot ARDrone SDK v1.8 using Visual Studio 2012 Express for Windows Desktop. I am running Windows 7 64-bit. The SDK is written in C, not C++.

I've managed to get through every error so far, but this one has me stumped.

When Run, I get these 3 messages in the Error List:
Warning 1 warning LNK4001: no object files specified; libraries used C:\Users\Netex\Desktop\ARDrone_SDK_Version_1_8_20110726\ARDrone_SDK_Version_1_8_20110726\Examples\Win32\VCProjects\ARDrone\Win32Client\LINK Win32Client

Error 2 error LNK2001: unresolved external symbol _mainCRTStartup C:\Users\Netex\Desktop\ARDrone_SDK_Version_1_8_20110726\ARDrone_SDK_Version_1_8_20110726\Examples\Win32\VCProjects\ARDrone\Win32Client\LINK Win32Client

Error 3 error LNK1120: 1 unresolved externals C:\Users\Netex\Desktop\ARDrone_SDK_Version_1_8_20110726\ARDrone_SDK_Version_1_8_20110726\Examples\Win32\VCProjects\ARDrone\Debug\Win32Client.exe Win32Client

I've tried many suggested solutions, including setting the SubSystem in Linker->System to "Not Set" and setting the entry point manually, which gets rid of the 2 errors and replaces it with:
`Error 2 error LNK1221: a subsystem can't be inferred and must be defined'

I've tried setting the Platform Toolset to v90 (which it was originally compiled in, I believe), which gets rid of the warning, but the errors persist.

QUESTION: What is causing these messages, and how can I fix it? Is it because I am trying to compile a Win32 console program on a 64-bit system?

Any help is much appreciated,

Dan

2
check under c/c++ code generation make sure the CRT is set. also make sure crt lib isn't ignored in the linker settingpaulm
where would I see if it is set? I see "RTC" in the Basic Runtime ChecksDanTheMan
also, there's nothing being ignored in any of the Linker settings, at least that I can see.DanTheMan
"code generation" should be set to something like "static debug dll" or somethingpaulm
the only place I'm seeing DLL is in the Runtime Library, where the options are: Multi-threaded (/MT) Multi-threaded Debug (/Mtd) Multi-threaded DLL (/MD) & Multi-threaded Debug DLL (/MDd) Is this what you're referring to?DanTheMan

2 Answers

0
votes

I'm using Qt VS Tools extension with Visual Studio 2019 and working in C++ on a Qt Gui Application created using the new project wizard. In my project properties under Configuration Properties | Linker | System, I have set SubSystem to "Console (/SUBSYSTEM:CONSOLE)" to cause a console window to come up alongside my GUI when debugging. This allows me to view outputs that I've added using qDebug like this:

qDebug() << "Testing";

What I have found is that if I perform a Build | Clean Solution and then Build | Build Solution, I get this error on the first build:

LNK2001 unresolved external symbol mainCRTStartup

Initially I was trying to figure out how to fix this (and ran across this post), but then I found that if I repeated Build | Build Solution the error goes away on subsequent builds, so my solution is to remember to build twice after a clean.

To see what would happen if I had never changed SubSystem to "Console (/SUBSYSTEM:CONSOLE)", I created a new Qt Gui Application project using the wizard. In this project SubSystem is set to "Windows (/SUBSYSTEM:WINDOWS)" as the default. Again I get the error on first build after a clean, but in this case it is a different unresolved symbol:

LNK2001 unresolved external symbol WinMainCRTStartup

Although I'm curious about the cause of the problem, the build twice solution is working for me for now.

0
votes

in my case, the solution was to explicitly name the 'entry point', e.g. with the command line:

ml64 main.asm /subsystem:console /entry:main

the last option: '/entry:main' was crucial