PDA

View Full Version : Easy OpenGL Prog, don't run



Frashman
06-08-2001, 04:52 AM
Hi

I read the OpenGL Programming Guide. But I can't run the first program. Can anybody help me please?

The Program:
#include "windows.h"
#include "GL\gl.h"
#include "GL\glaux.h"

void main ()
{
auxInitDisplayMode(AUX_SINGLE | AUX_RGBA);
auxInitPosition(0,0,500,500);
auxInitWindow("Test");

glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(-0.5,-0.5);
glVertex2f(-0.5,0.5);
glVertex2f(0.5,0.5);
glVertex2f(0.5,-0.5);
glEnd();
glFlush();


Sleep(10);

}

The Error:

--------------------Konfiguration: OpenGL2 - Win32 Debug--------------------
Linker-Vorgang läuft...
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glFlush@0
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glEnd@0
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glVertex2f@8
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glBegin@4
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glOrtho@48
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glLoadIdentity@0
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glMatrixMode@4
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glColor3f@12
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glClear@4
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol __imp__glClearColor@16
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol _auxInitWindowA@4
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol _auxInitPosition@16
main.obj : error LNK2001: Nichtaufgeloestes externes Symbol _auxInitDisplayMode@4
LIBCD.lib(wincrt0.obj) : error LNK2001: Nichtaufgeloestes externes Symbol _WinMain@16
Debug/OpenGL2.exe : fatal error LNK1120: 14 unaufgeloeste externe Verweise
Fehler beim Ausführen von link.exe.

OpenGL2.exe - 15 Fehler, 0 Warnung(en)

Please help me!!!!

Much thanks

Relic
06-08-2001, 06:11 AM
Uff, German compiler http://www.opengl.org/discussion_boards/ubb/wink.gif
You need to add OPENGL32.LIB and GLAUX.LIB to the linker files and _WinMain implies you translate a Windows project, but yours is a console program.

Frashman
06-08-2001, 06:36 AM
I use Visual C++ 6.
How to do this?

Much thanks. Sorry I am a C++ beginner.

Relic
06-08-2001, 06:51 AM
Know your tools! http://www.opengl.org/discussion_boards/ubb/wink.gif
Sorry, I have no German version.

Go to Project->Settings->Link, put the cursor in the "Object/Library modules" edit field and type opengl32.lib glu32.lib glaux.lib.

If that's not helping because of the WinMain problem generate a new console project File->New->Projects->Win32 Console Application start all over with the above.

Compare your compiler settings with some makefiles from the SDK GLAUX demos coming with the compiler!

But I'd suggest you skip glaux completely (it's dead) and start with GLUT (search www.opengl.org (http://www.opengl.org) or more info on that.)

06-08-2001, 06:56 AM
Du gehst in

Projekt/Einstellungen

<Einstellungen für> stellst Du auf: Alle Konfigurationen dann auf die Registerkarte Linker, dort fügst Du in die Zeile Objekt-/Bibliothek-Module am Ende opengl32.lib ein. Dann sollte alles laufen!

Viel Spass

Frashman
06-08-2001, 07:00 AM
It doesn't help.
I try to start with glut, if it is better.

much thanks to you

Frashman
06-08-2001, 07:05 AM
Juhu, es läuft!!! Danke

It runs, thanks