user2370139
user2370139

Reputation: 1305

Using glut with code blocks in Windows 7

i'm a total novice with OpenGL, and I have to compile a file (my first file using opengl), the headers of the file are :

#include <GL/glut.h>
#include <GL/gl.h>
#include <iostream>

I downloaded glut, put the glut.h in the right folder, and put the glut32lib in the right folder too (in Code Blocks).

I also linked glut32.lib in the linker settings.

But i can not compile, i have errors like this :

....\Desktop\OpenGL\OpenGL\prog3.o:prog3.cxx|| undefined reference to `__glutInitWithExit'|

Please can you help me ?

EDIT : Solution foud here : GLUT compile errors with Code::Blocks

All that was needed was #include before including GL/glut.h I don't know why...

Upvotes: 0

Views: 5869

Answers (1)

Ifan Iqbal
Ifan Iqbal

Reputation: 3093

This was my problem. I found solution for this problem in 2 step.

Step 1: follow instructions in this link: Using OpenGL & GLUT in Code::Blocks

Step 2: add #include <GL/glu.h> before #include <GL/glut.h>

Attention: you must create new project, not blank source file. Just follow how to do it in that link.

Upvotes: 1

Related Questions