Which option should I use to use main () instead of wmain ()

I have a Visual Studio working project that uses wmain() as an entry point. Instead, I would like to use main() .

If I just change the signature of the function to int main() , I get:

LNK2019 error: unresolved external _wmain character specified in function "void __cdecl mainCRTStartupHelper (struct HINSTANCE__ *, unsigned short const *)"

What parameter do I need to change to make the link successful?

+4
source share
2 answers

I found a solution, guessing.

Configuration Properties > Linker > Advanced > Entry Point

was: mainWCRTStartup

now: mainCRTStartup ## deleted W

Assembly completed successfully.

0
source

Insert the pragma into the source file before int main() .

#pragma comment (linker, "/ SUBSYSTEM: CONSOLE / ENTRY: mainCRTStartup")

In the Visual Studio project configuration, change the character set to Use multibyte character set .

0
source

Source: https://habr.com/ru/post/1495411/


All Articles