Sign in to follow this  

MS Visual C++ 2005 Express cannot find winmain

This topic is 3871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, My problem is with code ported from Visual C++ 6 to 2005 Express. The code is split into two projects, one is the core code compiled as a static library and contains the Winmain function, the other is the application project. The two projects are linked with the application being dependent on the core code project. On MSVC 6 the code compiles fine but on 2005 Express it cannot find the Winmain in the static lib and reports error LINK : fatal error LNK1561: entry point must be defined. The code works fine (compiles, links and runs) if I cut n paste the winmain into a cpp file the application project, so I can get it to work no problems but I'm curious as to why the compiler can't find the and use the Winmain when it's part of the static library. I have a singleton base class gameApp that is in the core static lib and the object representing the application is always of a class derived from gameApp. Winmain calls the base class gameApp::Run to start things off. So all I have to do is derive from gameApp in my application project and declare an object of this class and I have an Win32 application but on MSVC 6 I could keep the winmain in the core code of th static lib. Here's the winmain code:-
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR    lpCmdLine, int nCmdShow)
{
	// if an instance of a class derived from gameApp
	// exists then run it, else exit

	if (gameApp::getApp() != 0)
	{
	    return gameApp::getApp()->run(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
	}
	else
	    return 0;
}


Any thoughts on project settings to check or is what I'm trying to do not supported in 2005 Express? [Edited by - jonboym on June 13, 2007 4:44:38 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this