Hey OpenGL Programmers and C++ Users…
I am new with OpenGL and this OpenGL Forum yet…
So i use Dev C++ and i get installed FreeGLUT on Windows XP (at home i work on windows 7 and 10)…
Now i try if opengl works on Dev C++, but no… i get an error!..
Just this is my script copied from google yet…
#include <GL/glut.h>
void displayMe(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.5, 0.0, 0.0);
glVertex3f(0.5, 0.5, 0.0);
glVertex3f(0.0, 0.5, 0.0);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(300, 300);
glutInitWindowPosition(100, 100);
glutCreateWindow("Hello world :D");
glutDisplayFunc(displayMe);
glutMainLoop();
return 0;
}
Now i get an error in the returning function, so this is the error i get:
Compiling single file…
- Filename: C:\Documents and Settings\Eigenaar\Bureaublad\GLUT Test.cpp
- Compiler Name: TDM-GCC 4.9.2 32-bit Release
Processing C++ source file…
- C++ Compiler: C:\Program Files\Dev-Cpp\MinGW64\bin\g++.exe
- Command: g++.exe “C:\Documents and Settings\Eigenaar\Bureaublad\GLUT Test.cpp” -o “C:\Documents and Settings\Eigenaar\Bureaublad\GLUT Test.exe” -m32 -I"C:\Program Files\Dev-Cpp\MinGW64\include" -I"C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include" -I"C:\Program Files\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include" -I"C:\Program Files\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++" -L"C:\Program Files\Dev-Cpp\MinGW64\lib32" -L"C:\Program Files\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib32" -static-libgcc -m32
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x1c): undefined reference to_imp____glutInitWithExit@12' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x3e): undefined reference to
_imp____glutCreateWindowWithExit@8’
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x60): undefined reference to_imp____glutCreateMenuWithExit@8' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x7b): undefined reference to
_imp__glClear@4’
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x8c): undefined reference to_imp__glBegin@4' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0xb0): undefined reference to
_imp__glVertex3f@12’
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0xd4): undefined reference to_imp__glVertex3f@12' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0xf8): undefined reference to
_imp__glVertex3f@12’
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x11c): undefined reference to_imp__glVertex3f@12' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x126): undefined reference to
_imp__glEnd@0’
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x12d): undefined reference to_imp__glFlush@0' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x168): undefined reference to
_imp__glutInitDisplayMode@4’
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x181): undefined reference to_imp__glutInitWindowSize@8' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x19a): undefined reference to
_imp__glutInitWindowPosition@8’
C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x1ba): undefined reference to_imp__glutDisplayFunc@4' C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\ccDvQv6O.o:GLUT Test.cpp:(.text+0x1c4): undefined reference to
_imp__glutMainLoop@0’
collect2.exe: error: ld returned 1 exit statusCompilation results…
- Errors: 1
- Warnings: 0
- Compilation Time: 1,17s
I am an newbie with OpenGL and i use Dev C++ for it…, Please can anyone help me to correct my code ?..
Thanks for help, Jamie.