Why my code can not be compiled :(

my code is at below:

/********************************************/
#include <GL/glut.h>
#include <GL/glu.h>
#include <GL/gl.h>
#include <windows.h>

main()
{
InitializeAWindowPlease();

glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
	glVertex3f(0.25, 0.25, 0.0);
	glVertex3f(0.75, 0.25, 0.0);
	glVertex3f(0.75, 0.75, 0.0);
	glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
UpdateTheWindowAndCheckForEvents();

}
/***********************************************/

When I build that… there would be 4 errors:

test_one.obj : error LNK2001: unresolved external symbol _UpdateTheWindowAndCheckForEvents

test_one.obj : error LNK2001: unresolved external symbol _InitializeAWindowPlease

LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16

Debug/test_one.exe : fatal error LNK1120: 3 unresolved externals

please help me…why such errors are there… :frowning:

Thanks! :confused:

Originally posted by Marco2005:
[b]my code is at below:

/********************************************/
#include <GL/glut.h>
#include <GL/glu.h>
#include <GL/gl.h>
#include <windows.h>

main()
{
InitializeAWindowPlease();

glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
UpdateTheWindowAndCheckForEvents();
}
/***********************************************/

When I build that… there would be 4 errors:

test_one.obj : error LNK2001: unresolved external symbol _UpdateTheWindowAndCheckForEvents

test_one.obj : error LNK2001: unresolved external symbol _InitializeAWindowPlease

LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16

Debug/test_one.exe : fatal error LNK1120: 3 unresolved externals

please help me…why such errors are there… :frowning:

Thanks! :confused: [/b]
Hello there,
You have taken this code from the opengl programming guide presumably. There is no such function in opengl as InitializeAWindowPlease(); or UpdateTheWindowAndCheckForEvents(); These functions are given here as place holders. Depending upon your OS, you have to do the opening and closing of windows and other os related stuff in plavce of these place holders. If you use glut, window handling will be dealt with by glut itself otherwise you would have to give WinMain handler yourself. Have a look at nehe’s turoials at http://www.nehe.gamedev.net or Nate robins turotials at http://www.xmission.com/~nate/opengl for help on this. Check both glut and win32 stuff. thanx

Don’t forget the programming guide, th is simply the best method to visualise how-to-render-a-thing/effect