PDA

View Full Version : Begginer needs help


masigor
07-13-2005, 03:18 PM
Hi,I am new to openGL.I have downloaded glut 3.7.6(compiler dev c++ 4.9.9.2,system Windows XP). I try to compile this code(first tutorial):

#include <GL/glut.h>
void init()
{
glClearColor(1,0,0,1);
glOrtho(0,1,0,1,0,1);
}

void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

void main(int argc, char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(800,600);
glutInitWindowPosition(5,20);
glutCreateWindow("Tutoral 1");
init();
glutDisplayFunc(display);
glutMainLoop();

}

and recived this linking error:

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\re.cpp" -o "C:\Dev-Cpp\re.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0x2a):re.cpp: undefined reference to `glClearColor@16'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0x55):re.cpp: undefined reference to `glOrtho@48'

C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0x6c):re.cpp: undefined reference to `glClear@4'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0x74):re.cpp: undefined reference to `glFlush@0'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0xb2):re.cpp: undefined reference to `glutInit'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0xbe):re.cpp: undefined reference to `glutInitDisplayMode'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0xd2):re.cpp: undefined reference to `glutInitWindowSize'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0xe6):re.cpp: undefined reference to `glutInitWindowPosition'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0xf2):re.cpp: undefined reference to `glutCreateWindow'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0x103):re.cpp: undefined reference to `glutDisplayFunc'
C:\DOCUME~1\Dragana\LOCALS~1\Temp/ccwjbaaa.o(.text+0x108):re.cpp: undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status

Execution terminated
I need a help!

Ed Mack
07-13-2005, 06:06 PM
Goto project options and find the field 'Linker' (or of a similar name), and add this to it:

-lopengl32
-lglu32
-lglut

Those should link to all the libraries you will use

masigor
07-14-2005, 06:00 AM
It works.I have added this to 'Linker' project options: -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32.Thank you!!!

Ed Mack
07-14-2005, 09:42 AM
No probs - I've used devc++ for a cross-platform project of mine and have minor experience with it.