Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Unresolved external?
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Psiborg




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: Thu Sep 30, 2004 4:46 pm   Post subject: (No 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?
wtd




PostPosted: Thu Sep 30, 2004 4:55 pm   Post subject: (No subject)

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




PostPosted: Thu Sep 30, 2004 7:10 pm   Post subject: (No 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
wtd




PostPosted: Thu Sep 30, 2004 7:14 pm   Post subject: (No 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...
rizzix




PostPosted: Thu Sep 30, 2004 7:16 pm   Post subject: (No 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.
wtd




PostPosted: Thu Sep 30, 2004 7:24 pm   Post subject: (No subject)

rizzix wrote:
he had got it right before


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




PostPosted: Thu Sep 30, 2004 7:28 pm   Post subject: (No 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
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Thu Sep 30, 2004 7:35 pm   Post subject: (No 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.
rizzix




PostPosted: Thu Sep 30, 2004 7:39 pm   Post subject: (No subject)

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




PostPosted: Thu Sep 30, 2004 7:44 pm   Post subject: (No 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
Psiborg




PostPosted: Thu Sep 30, 2004 8:48 pm   Post subject: (No subject)

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




PostPosted: Fri Oct 01, 2004 7:22 am   Post subject: (No subject)

Check the lessons on nehe.gamedev.net.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: