GLUT link error !

below is a simple code sample :

#include <GL\glut.h>
void display (void);
void main (int argc, char **argv)
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (0,0);
glutCreateWindow (“OpenGL”);
void display (void)

and following is a link error concerning the above code sample:

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

so what is the matter and solution for it?
(i am using visual c++ 6.0 compiler under win2K)

thank you…

There is a lot of solutions like: reading the manuals, reading tutorials on how to set up a window with glut, learning how to use VC++ properly, posting to the correct forum (ie. not the advanced one), and optionnally creating the correct project type in VC++ (a console application) ?


What Ysaneya said. This is not an advanced question, nor is it even an OpenGL question. Thread closed.

– Tom

Moving to the toolkits forum.

Is the project a Win32 console project or a Win32 Application project

HI ak

most simply speaking, I guess you are trying to compile a project that you’ve set to be of type “Win32 application” whereas the code you’ve keyed in is for a “Win32 console applictaion”

if you’ve worked on any version of c ever before you must be knowing that “main” is the entry point for a program. as far as windows is concerned, the entry point goes by the name of “WinMain”. theres where your compiler gets confused. you must’ve specified an application of type “Win32 Application” so your compiler is looking for a “WinMain” rather than “main”.

i hope things muct be clear now, try creating a console application and use the same code. :slight_smile:

Girish Sarwal
Platinum Rogue