[SDL] cross-compiling woes

Gabriel mystml at adinet.com.uy
Mon Jan 17 21:00:05 PST 2005


> /usr/lib/gcc/i586-mingw32msvc/3.4.2/../../../../i586-mingw32msvc/lib/libmingw32.a(main.o)(.text+0xf4):
> undefined reference to `_WinMain at 16'
> collect2: ld returned 1 exit status

Your entry point is main(), right? I use something like this :

#ifdef WIN32
extern "C"
{

int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
char* lpCmdLine, int nCmdShow)
{

	// Parse command line
	String sParms = lpCmdLine;
	StringList lParms = sParms.split();

	int nParms = lParms.getLength();
	char** pParms = new (char*)[nParms + 1];

	pParms[0] = new char[8];
	strcpy(pParms[0], "(dummy)");

	for (int i = 0; i < nParms; i++)
	{
		pParms[i+1] = new char[strlen(lParms[i]) + 1];
		strcpy(pParms[i+1], lParms[i]);
	}

	// Do main
	int nRet = main(nParms + 1, pParms);

	// Cleanup
	for (int i = 0; i < nParms + 1; i++)
		delete pParms[i];

	delete [] pParms;

	return nRet;
}

}
#endif






More information about the SDL mailing list