PDA

View Full Version : Somebody know about?



tony_ee81
09-07-2002, 05:57 PM
Hi Guys,
while compiling my programme i found the following message,

Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/mahmood.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


If someone has idea about it?

thanks for your time.

Tony

Rob The Bloke
09-07-2002, 07:29 PM
Yup, I guess you are trying to compile a console application and have used main(), however the project is set up as a Win32 Application and is looking for the windows entry point WinMain().

tinak
09-08-2002, 05:35 AM
There is a way round this though... well, if in VisualC++ 6.0.

Place this at the beginning of your win32 app (all in one line that is) and it will let it run with no problems... as main() though.


#pragma comment( linker, "/entry:\"mainCRTStartup\"" )


Then set the entry point to something like the following:

int main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(640,480);
glutCreateWindow("blah");
GLSettings();
GLFunctions();
glMatrixMode(GL_PROJECTION);
gluPerspective(45,1.0,10.0,200.0);
glMatrixMode(GL_MODELVIEW);
glutMainLoop();
return 0;
}

Works wonderfully, and whats good is that you can easily port this to a console app later on by just removing the pragma command.

Tina

tony_ee81
09-08-2002, 09:49 PM
Hi,
i tried to compile in the console mode and this time i got a new problem, like this

fatal error C1083: Cannot open include file

What might be the possible cause. Any suggestion or help is appreciated.

Tony

tinak
09-09-2002, 03:40 AM
What include file did it specify? Does this file exist in the include directory of the compiler or listed amongst the directories to use for the include files within the IDE?

I've only known this type of problem to occur when the compiler doesn't know where the file is or the file really isn't there.

Maybe you took an example from a different operating system that has a special set of header files like unix and unistd.h for example.

Tina