How to set up you CodeBlocks for openGL
How to set up your CodeBlocks for openGL
I am using CodeBlocks version 8.02 but I think the steps that I am going to teach is applicable to all newer version of CodeBlocks.
Steps:
1.Files to download
- gl.h
- glu.h
- glut.h
- libglu32.a
- libglut32.a
- libopengl32.a
- glu32.dll
- glut32.dll
- opengl32.dll
2. Copy the 3 downloaded header files
- gl.h
- glu.h
- glut.h
- and paste to C:\Program Files\CodeBlocks\MinGW\include\GL
3. Copy the 3 downloaded library files
- libglu32.a
- libglut32.a
- libopengl32.a
- and paste to C:\Program Files\CodeBlocks\MinGW\lib
4. Copy the 3 downloaded DLL files
- glu32.dll
- glut32.dll
- opengl32.dll
- and paste to C:\WINDOWS\system32
5. After you have done all the above steps, it should compile, if not:
-Did you forget to include your files in your code?
- Example :
#include <cstdlib> #include <cstdio> #include <GL/glut.h>
-Did you make an empty project for your .cpp and header files?
- In CodeBlocks: File->New->Project->Empty Project->then input you desire project name and path.
- After you created your project file, on the left panel of your CodeBlocks right click your project (Go to: View->Manager) and "Add files".
- Add your .cpp and header files.
-Add linker to your project file.
- Right click project name->Build options
- Choose your project.
- Select Linker settings.
- Add your library files.