
-----------------------------------
Psiborg
Thu Sep 30, 2004 3:00 pm

Unresolved external?
-----------------------------------
This is my code:

#include 
#include 

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

-----------------------------------
Mazer
Thu Sep 30, 2004 4:46 pm


-----------------------------------
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
Thu Sep 30, 2004 4:55 pm


-----------------------------------
Sounds about right.  Welcome to programming the Microsoft way.  :)

-----------------------------------
rizzix
Thu Sep 30, 2004 7:10 pm


-----------------------------------
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
Thu Sep 30, 2004 7:14 pm


-----------------------------------
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
Thu Sep 30, 2004 7:16 pm


-----------------------------------
he had got it right before 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
Thu Sep 30, 2004 7:24 pm


-----------------------------------
he had got it right before

I suspected as much, but wanted to let someone more familiarwith OpenGL comment.

-----------------------------------
rizzix
Thu Sep 30, 2004 7:28 pm


-----------------------------------
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 :P

-----------------------------------
wtd
Thu Sep 30, 2004 7:35 pm


-----------------------------------
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 :P

Well, I'm bored at the moment, impatiently waiting for my new camera to arrive.

http://www.fotografovani.cz/images/minolta_Z2_001.jpg

-----------------------------------
rizzix
Thu Sep 30, 2004 7:39 pm


-----------------------------------
haha yea.. a friend of mine wanted a camera too.. but he use the cash to buy himself a powerbook instead..  :lol:

-----------------------------------
wtd
Thu Sep 30, 2004 7:44 pm


-----------------------------------
haha yea.. a friend of mine wanted a camera too.. but he use the cash to buy himself a powerbook instead..  :lol:

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.  ;)

-----------------------------------
Psiborg
Thu Sep 30, 2004 8:48 pm


-----------------------------------
Ok then how do i open only 1 window in C++ without using glut?

-----------------------------------
Mazer
Fri Oct 01, 2004 7:22 am


-----------------------------------
Check the lessons on nehe.gamedev.net.
