User forums > Help
opengl linker errors
katerpeter:
i just downloaded code::blocks v1.0rc2 because the new Dev-c++ jus' pissed me off. i tried to compile my opengl code and it gave me these three errors:
undefined reference to `__glutInitWithExit@12'
" " to `__glutCreateWindowWithExit@8'
" " to `__glutCreateMenuWithExit@8'
here's my source file:
--- Code: (cpp) ---#include <GL/glu.h>
#include <GL/glut.h>
void display (void){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,1);
glBegin(GL_TRIANGLES);
glVertex3f(2,2,0);
glVertex3f(2,-2,0);
glVertex3f(-2,-2,0);
glVertex3f(2,2,0);
glVertex3f(-2,2,0);
glVertex3f(-2,-2,0);
glColor3f(1,0,0);
glVertex3f(0,4,0);
glVertex3f(2,2,0);
glVertex3f(-2,2,0);
glVertex3f(0,4,0);
glVertex3f(0,8,0);
glVertex3f(-2,6,0);
glVertex3f(0,4,0);
glVertex3f(0,8,0);
glVertex3f(2,6,0);
glColor3f(0,1,0);
glVertex3f(-4,0,0);
glVertex3f(-2,2,0);
glVertex3f(-2,-2,0);
glVertex3f(-4,0,0);
glVertex3f(-6,2,0);
glVertex3f(-6,-2,0);
glVertex3f(-6,2,0);
glVertex3f(-6,-2,0);
glVertex3f(-8,0,0);
glColor3f(0,0,1);
glVertex3f(-2,-2,0);
glVertex3f(2,-2,0);
glVertex3f(0,-4,0);
glVertex3f(0,-4,0);
glVertex3f(0,-8,0);
glVertex3f(-2,-6,0);
glVertex3f(0,-4,0);
glVertex3f(0,-8,0);
glVertex3f(2,-6,0);
glColor3f(1,1,0);
glVertex3f(2,2,0);
glVertex3f(2,-2,0);
glVertex3f(0,4,0);
glVertex3f(0,4,0);
glVertex3f(6,2,0);
glVertex3f(6,-2,0);
glVertex3f(6,-2,0);
glVertex3f(6,2,0);
glVertex3f(8,0,0);
glEnd();
}
void init (void) {
glClearColor(0,0,0,0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-10,10,-10,10,0,0);
}
int main(char *argv[], int argc){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(800,600);
glutInitWindowPosition(0,0);
glutCreateWindow("Triangles");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}}
--- End code ---
Thanks in advance!!
thomas:
Apparently, you did not add the glut library to your linker options.
Two things to note:
1. GLUT is quite old and abandoned for several years now. Although it is still possible to develop with GLUT, you might want to consider something else if you can. (freeglut if you need something as close as possible, otherwise you maybe want to look at GLEW).
2. Code::Blocks RC2, too, is quite old and outdated by now. You might want to consider using a nightly build before starting to work with RC2. The nightly builds are from the present development version and are a lot more stable and better usable. Also, RC2 stores its settings in the Windows registry, which we abandoned months ago.
If for no other reason, you may want to use a nightly build because you will lose the settings that you apply to RC2 if you ever update later.
sethjackson:
You may want to loook at OGRE. :)
thomas:
--- Quote from: sethjackson on June 25, 2006, 04:07:19 pm ---You may want to loook at OGRE. :)
--- End quote ---
Erm... not seriously :)
sethjackson:
--- Quote from: thomas on June 25, 2006, 06:25:39 pm ---
--- Quote from: sethjackson on June 25, 2006, 04:07:19 pm ---You may want to loook at OGRE. :)
--- End quote ---
Erm... not seriously :)
--- End quote ---
Welll. I have never used it. :lol: Just heard of it.... So do you mean it is not so great?
Navigation
[0] Message Index
[#] Next page
Go to full version