Jump to content


Begginer needs help


  • You cannot reply to this topic
3 replies to this topic

#1 masigor

    New Member

  • Members
  • Pip
  • 2 posts

Posted 13 July 2005 - 10: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!

#2 Ed Mack

    Senior Member

  • Members
  • PipPipPipPip
  • 1239 posts

Posted 14 July 2005 - 01:06 AM

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

#3 masigor

    New Member

  • Members
  • Pip
  • 2 posts

Posted 14 July 2005 - 01:00 PM

It works.I have added this to 'Linker' project options: -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32.Thank you!!!

#4 Ed Mack

    Senior Member

  • Members
  • PipPipPipPip
  • 1239 posts

Posted 14 July 2005 - 04:42 PM

No probs - I've used devc++ for a cross-platform project of mine and have minor experience with it.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users