문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top