PDA

View Full Version : error LNK2019: unresolved external symbol _WinMain@16 referenced in function



banlinhtienphong
28th April 2011, 17:04
error LNK2019: unresolved external symbol _WinMain@16 referenced in function
I use SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE) in cmakelists.txt but get above error.Help me...Thank in advance!

Nazgul
28th April 2011, 18:16
WinMain is a windows function right? so you would have to include windows.h or use int main() instead.

banlinhtienphong
29th April 2011, 01:26
error occur only when I use SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE) in cmakelists.txt.If I remove this command then result is OK.Why is cannot set properties of target?

squidge
29th April 2011, 09:13
Qt projects don't use WinMain as far as I'm aware. You don't need that flag anyway, you can just use the linker flag "/SUBSYSTEM:WINDOWS".