_tWinMain in static lib LNK2019
-
04-07-2021 - |
Вопрос
I try put main(WinMain) in static library:
#include <tchar.h>
#include <Windows.h>
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow) {...}
but I got:
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
I tried to build as "Unicode", and as "Multi-byte".
I tried write without "_t" (and LPSTR).
I tried write extern "C".
Linker flags include /SUBSYSTEM:WINDOWS
and my static lib
I know that it's possible, because it's done in libraries like SDL, SFML, etc.
Решение
Your problem is that the function in the lib is called _tWinMain.
Just call it WinMain and you are good to go.
Не связан с StackOverflow