PDA

View Full Version : Unable to successfully compile tutorial



SilentStrike
02-19-2001, 03:11 PM
I am using Visual C++ 6. I added the windows header and linked to neccesary libraries but I can't get rid of this error. What is the problem? The error and source are below.

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

OpenGL.exe - 2 error(s), 0 warning(s)

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

void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}

void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glLoadIdentity (); /* clear the matrix */
/* viewing transformation */
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glScalef (1.0, 2.0, 1.0); /* modeling transformation */
glutWireCube (1.0);
glFlush ();
}

void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
glMatrixMode (GL_MODELVIEW);
}

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}

rts
02-19-2001, 03:18 PM
Winblows doesn't use "main", it uses WinMain as its entry point.

You'll either need to write a WinMain function, or turn your project into a Console Application.

Don't ask me for help on either of these things, since a) I don't know how and b) I hate Visual Anything++.

SilentStrike
02-19-2001, 03:25 PM
Thanks.. It was a windows application when it should have been a console app.