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.

More by this Author


Comments 3 comments

Annoymous 5 years ago

Good work well done.


Mike 4 years ago

Files to download? From where? I have the header files and dlls but can't find the '.a' libraries.


Johnk282 2 years ago

Enjoyed studying this, very good stuff, regards . A man may learn wisdom even from a foe. by Aristophanes. ddedadkekebd

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working