WinMain as a member function
-
Hello, i am fairly new to c++ (worked mainly with java 'til now) and i was wondering if anybody could help me with with a certain linker error i am getting, the error that tells me i have unresolved externals (lnk2001, lnk2019) specifically in "_WinMain" in "_CRTstartup@16" i think this has something to do with my WinMain method be a member function (it is static so there is no hidden "this" parameter) but don't don't know what else to do, is my WinMain declaration: static int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) thanks to anyone who can help me.
-
Hello, i am fairly new to c++ (worked mainly with java 'til now) and i was wondering if anybody could help me with with a certain linker error i am getting, the error that tells me i have unresolved externals (lnk2001, lnk2019) specifically in "_WinMain" in "_CRTstartup@16" i think this has something to do with my WinMain method be a member function (it is static so there is no hidden "this" parameter) but don't don't know what else to do, is my WinMain declaration: static int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) thanks to anyone who can help me.
Please consult the docs for compiler/linker errors! You need to create an entry point to
wWinMainCRTStartup
. Go to the Project Settings dialog box. Click the Link tab, and click Output in the Category box.
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?
-
Hello, i am fairly new to c++ (worked mainly with java 'til now) and i was wondering if anybody could help me with with a certain linker error i am getting, the error that tells me i have unresolved externals (lnk2001, lnk2019) specifically in "_WinMain" in "_CRTstartup@16" i think this has something to do with my WinMain method be a member function (it is static so there is no hidden "this" parameter) but don't don't know what else to do, is my WinMain declaration: static int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) thanks to anyone who can help me.
The compiler is right, as is the previous replier. The stub code from the compiler is trying to link to a WinMain function. You've provided a static (well done!) function in a class, which is not actually called WinMain. Its name is CMyClass::WinMain. Just to complicate things, due to overloading considerations it will actually be called £$%^&CMyClass£$%^&WinMain£$%^&. The punctuation is my pretend name decoration. So you need a class plain WinMain function. Feel free to have only one line of code in it which calls your class's static WinMain function though. Iain.
-
Hello, i am fairly new to c++ (worked mainly with java 'til now) and i was wondering if anybody could help me with with a certain linker error i am getting, the error that tells me i have unresolved externals (lnk2001, lnk2019) specifically in "_WinMain" in "_CRTstartup@16" i think this has something to do with my WinMain method be a member function (it is static so there is no hidden "this" parameter) but don't don't know what else to do, is my WinMain declaration: static int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) thanks to anyone who can help me.
try #pragma comment( linker, "/ENTRY:WinMain" ), but the function mustn have any parameters!! get the hinstance by GetModuleHandle, and the cmdline by GetCommandLine Don't try it, just do it! ;-)