Computer Science Canada

Unresolved external?

Author:  Psiborg [ Thu Sep 30, 2004 3:00 pm ]
Post subject:  Unresolved external?

This is my code:

code:
#include <GL/glut.h>
#include <stdlib.h>

void display (void)
{
        //Clear all pixels
        glClear (GL_COLOR_BUFFER_BIT);

        //Set colour and draw polygon

        glColor3f (1.0, 1.0, 0.0);      //Set colour to yellow
        glBegin (GL_POLYGON);
                glVertex3f (10.0, 10.0, 0.0);
                glVertex3f (10.0, 90.0, 0.0);
                glVertex3f (90.0, 90.0, 0.0);
                glVertex3f (90.0, 10.0, 0.0);
        glEnd ();

        glFlush ();

}

void init (void)
{
        glClearColor (1.0, 1.0, 1.0, 0.0);

        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
        glOrtho (0.0, 100.0, 0.0, 100.0, -1.0, 1.0);

}

int main (int argc, char** argv)
{
        glutInit (&argc, argv);
        glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
        glutInitWindowSize (100, 100);
        glutInitWindowPosition (400, 400);
        glutCreateWindow ("Simple Polygon");
        init ();
        glutDisplayFunc (display);
        glutMainLoop();
        return 0;
}


I am using a Win32 application. I was using a Win32 console application but it kept opening 2 windows. But now it gives the error "unresolved external symbol _WinMain@16"

Need help,
Psiborg

Author:  Mazer [ Thu Sep 30, 2004 4:46 pm ]
Post subject: 

If I remember correctly, (and I probably don't) making a Win32 application would mean you need to have a WinMain() function instead of the regular main() function.
Can anybody else verify this?

Author:  wtd [ Thu Sep 30, 2004 4:55 pm ]
Post subject: 

Sounds about right. Welcome to programming the Microsoft way. Smile

Author:  rizzix [ Thu Sep 30, 2004 7:10 pm ]
Post subject: 

u know i would agree. but he's using the GLUT framework.. and the glut does not require you the programmer to do anything directly with the windows api.. it does it for you... thus u dont have a WinMain() function for such a program.. his code is correct.. and i think glut on windows has to always be compile as a console application

Author:  wtd [ Thu Sep 30, 2004 7:14 pm ]
Post subject: 

rizzix wrote:
u know i would agree. but he's using the GLUT framework.. and the glut does not require you the programmer to do anything directly with the windows api.. it does it for you... thus u dont have a WinMain() function for such a program.. his code is correct.. and i think glut on windows has to always be compile as a console application


Well, if the IDE thinks he's trying to create a Win32 app...

Author:  rizzix [ Thu Sep 30, 2004 7:16 pm ]
Post subject: 

he had got it right before
Quote:
I was using a Win32 console application but it kept opening 2 windows.
what he dosen't understand that showing two windows is normal when using the glut framework under windows.. he should switch back to win32 console

one window is the console the other is the actual window showing the opengl rendered stuff.

Author:  wtd [ Thu Sep 30, 2004 7:24 pm ]
Post subject: 

rizzix wrote:
he had got it right before


I suspected as much, but wanted to let someone more familiarwith OpenGL comment.

Author:  rizzix [ Thu Sep 30, 2004 7:28 pm ]
Post subject: 

yea i know.. but i'm too lazy to comment.. but then again of course if things tend to lead in the wrong direction.. i blame myself for it and try and correct things asap.

speaking of which.. nice to have you around in the java/c++ sections Razz

Author:  wtd [ Thu Sep 30, 2004 7:35 pm ]
Post subject: 

rizzix wrote:
yea i know.. but i'm too lazy to comment.. but then again of course if things tend to lead in the wrong direction.. i blame myself for it and try and correct things asap.

speaking of which.. nice to have you around in the java/c++ sections Razz


Well, I'm bored at the moment, impatiently waiting for my new camera to arrive.

Posted Image, might have been reduced in size. Click Image to view fullscreen.

Author:  rizzix [ Thu Sep 30, 2004 7:39 pm ]
Post subject: 

haha yea.. a friend of mine wanted a camera too.. but he use the cash to buy himself a powerbook instead.. Laughing

Author:  wtd [ Thu Sep 30, 2004 7:44 pm ]
Post subject: 

rizzix wrote:
haha yea.. a friend of mine wanted a camera too.. but he use the cash to buy himself a powerbook instead.. Laughing


Well, the DiMAGE Z2 and a Powerbook aren't exactly in the same price range.

Besides, I have two computers that are decent, and I kinda want to do something not entirely computer-centric for awhile. Gotta enjoy freedom before the wife starts getting too kid-crazy, and that's not looking like it's too far off. Wink

Author:  Psiborg [ Thu Sep 30, 2004 8:48 pm ]
Post subject: 

Ok then how do i open only 1 window in C++ without using glut?

Author:  Mazer [ Fri Oct 01, 2004 7:22 am ]
Post subject: 

Check the lessons on nehe.gamedev.net.


: