I added WIN32 in ADD_EXECUTABLE of CMake
But I am getting the following error,
error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
![]()
I added WIN32 in ADD_EXECUTABLE of CMake
But I am getting the following error,
error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
![]()
Thanks,
Rajesh.S
Did you forgot to add QT_QTMAIN_LIBRARY to target_link_libraries ?
Make clean (or at least delete main.o) and rebuild. Sources haven't changed so you need to force a rebuild by hand.
J-P Nurmi
I did clean and then build ,still i am getting same error.
I am suspecting my main implementation,
i am using main like below,
Qt Code:
int main(int argc,char* argv[]) { MyMainWindow mainWnd; mainWnd.show(); return myApp.exec(); }To copy to clipboard, switch view to plain text mode
MyMainWindow is derived from QMainWindow.
Is my main implementation correct ?
Last edited by wysota; 26th March 2008 at 08:11. Reason: missing [code] tags
Thanks,
Rajesh.S
Yes, it's fine. Your project file has to be incorrect.
Now I solved by adding following Lines in the CMakeLists.txt File.
IF(WIN32)
LINK_LIBRARIES(
${QT_QTMAIN_LIBRARY}
)
ENDIF(WIN32)
IF(WIN32)
ADD_DEFINITIONS(-DQT_DLL)
ENDIF(WIN32)
and then ,
WIN32 in ADD_EXUCUTABLE
Thanks,
Rajesh.S
No need to add this for WIN32 only. ${QT_QTMAIN_LIBRARY} is just empty on linux and QT_DLL is ignored (why do you need it at all?)
rajeshs (27th March 2008)
Bookmarks