I'm using CMake to build a Qt based application of mine on Windows with Visual Studio 2010 Express. When configuring with cmake I get the following error:
System runtime library file does not exists: 'MSVC10_REDIST_DIR-NOTFOUND/x86/Microsoft.VC100.CRT/msvcp100.dll System runtime library file does not exists: 'MSVC10_REDIST_DIR-NOTFOUND/x86/Microsoft.VC100.CRT/msvcr100.dll
Then when I try to compile, I'm getting this error (both trying in Visual Studio, and with msbuild):
MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Users\Kurtis\sandbox\UDJ-Desktop-Client\build\src\Release\UDJ.exe : fatal error LNK1120: 1 unresolved externals
I determined that Microsoft Visual C++ 2010 Express doesn't come with the <a href="http://www.cmake.org/pipermail/cmake/2011-May/044166.html" rel="nofollow">redistributable that I need</a>. So I went to Microsoft's website to download the redistributable (both for <a href="http://www.microsoft.com/en-us/download/details.aspx?id=5555" rel="nofollow">x86</a> and <a href="http://www.microsoft.com/en-us/download/details.aspx?id=14632" rel="nofollow">x64</a>). However, after installing it, I'm still getting the above configure and compile errors. Does anyone know what I'm doing wrong, or how to fix my problem?Answer1:
_WinMain@16 is the entry point of a Windows GUI application, so either it's missing from your source code, or you're not writing a GUI application, in which case your linker flags are incorrect.
Since you're using qt, make sure you have the QtMain Library being linked with your project. You can do this by adding it in your call to Find_Package like so:
find_package(Qt4 4.7.0 COMPONENTS QtMain QtCore QtGui QtSQL Phonon REQUIRED)