I was trying to use GLUT with Dev-CPP. It seems it does not work bcos the linker is giving some undefined references error.
Please provide help.
Regards and thanks in advance.
I was trying to use GLUT with Dev-CPP. It seems it does not work bcos the linker is giving some undefined references error.
Please provide help.
Regards and thanks in advance.
it might help if you actually post the linker’s error messages
For example I used
glClearColor(1,0,0,1);
The linker gives undefined reference to
__imp__glClearColor…
!!! :eek:
I have used the line
#include <GL\glut.h>
and completed the neccessary formalities of copying the library files and dll files to the necessary places.
Do I need to locally compile again… ???
Here are the compiler message while compiling
Executing g++.exe…
g++.exe “D:\shudh\ccodes\ogl_vertex_data\ogl_vertex_data est.cpp” -o “D:\shudh\ccodes\ogl_vertex_data\ogl_vertex_data est.exe” -I"C:\apps\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\apps\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\apps\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\apps\Dev-Cpp\include\c++\3.4.2" -I"C:\apps\Dev-Cpp\include" -L"C:\apps\Dev-Cpp\lib" -lglu32
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0x2a):test.cpp: undefined reference to glClearColor@16' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0x55):test.cpp: undefined reference to
glOrtho@48’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0x6c):test.cpp: undefined reference to glClear@4' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0x74):test.cpp: undefined reference to
glFlush@0’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0xb2):test.cpp: undefined reference to glutInit' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0xbe):test.cpp: undefined reference to
glutInitDisplayMode’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0xd2):test.cpp: undefined reference to glutInitWindowSize' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0xe6):test.cpp: undefined reference to
glutInitWindowPosition’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0xf2):test.cpp: undefined reference to glutCreateWindow' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0x103):test.cpp: undefined reference to
glutDisplayFunc’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cc4cbaaa.o(.text+0x108):test.cpp: undefined reference to `glutMainLoop’
collect2: ld returned 1 exit status
Execution terminated
You should link the libraries with Dev-Cpp, this IDE’s using MingW compiler (which is a winport of Gcc\un!x)
you should link libs like you linked glu library, for opengl lib and glut lib, because glut != opengl
-lgl -> opengl lib
-lglu32 -> glu lib // you linked that
-lglut -> glut lib
-lwhat_you_want -> what you want lib
hope that helps
Ya I compiled with Dev-CPP only which works on MingW32.
Unfortunately that -lgl option is not working … !!!
That means I should have a file name libgl.a or something… Where can I get that file ???
Please help…
Help this the code and it is not working
#include <windows.h>
#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();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB|GLUT_SINGLE);
glutInitWindowSize(800,600);
glutInitWindowPosition(5,20);
glutCreateWindow(“Tutorial 1”);
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
The error messages given by the compiler are as follows:
g++.exe “D:\shudh\ccodes\ogl_vertex_data\ogl_vertex_data est.cpp” -o “D:\shudh\ccodes\ogl_vertex_data\ogl_vertex_data est.exe” -I"C:\apps\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\apps\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\apps\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\apps\Dev-Cpp\include\c++\3.4.2" -I"C:\apps\Dev-Cpp\include" -L"C:\apps\Dev-Cpp\lib" -lglu32 -lopengl32 -lglut -mwindows
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cce6aaaa.o(.text+0xb2):test.cpp: undefined reference to glutInit' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cce6aaaa.o(.text+0xbe):test.cpp: undefined reference to
glutInitDisplayMode’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cce6aaaa.o(.text+0xd2):test.cpp: undefined reference to glutInitWindowSize' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cce6aaaa.o(.text+0xe6):test.cpp: undefined reference to
glutInitWindowPosition’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cce6aaaa.o(.text+0xf2):test.cpp: undefined reference to glutCreateWindow' C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cce6aaaa.o(.text+0x103):test.cpp: undefined reference to
glutDisplayFunc’
C:\DOCUME~1\SUDDHA~1\LOCALS~1\Temp/cce6aaaa.o(.text+0x108):test.cpp: undefined reference to `glutMainLoop’
collect2: ld returned 1 exit status
Execution terminated