Configuring OpenGL in Code:: blocks

Configuring OpenGL in Codeblocks is slightly different than configuring OpenGL in VC, VS, and requires slightly different library files. This article takes CB13 as an example. (Old and new versions are common, but it is best to use mingw tools, GCC/GDB, etc., other compiled kernels are not tested)
First, download the library files (downloaded at the bottom of the article, uploaded to the 100 cloud, if the link fails, you can reply or email me to continue the upload), including Glut. h, Glut32.dll, LibGlut32.a.

    Put the glut32. h file under the MinGw\include\GL directory and the glut32. DLL file under the C:\Windows\ system32 directory (for 64-bit operating systems, put the file under the C:\Windows\SysWOW64 directory) and the libglut32.a file under the MinGw\lib\ directory
(From the blog of CSDN WWWISKEY)
And then you set up the project, and notice that you set up the project for GLUT

The next step, when I get here,

Path selection:

Different installation paths and different systems may vary, but choose the MinGW folder under the CodeBlocks installation path.
Then proceed, when it is time to select the Project name and save the path, the path must not be in Chinese, and it is better not to be on the desktop (sometimes can not compile, CB common fault). Once established, you can open the Main.cpp sample program in the Projects TAB of the Management sidebar on the left.
Not yet, select the top column Project->; Build Options, click the Debug TAB on the left, the Linker Setting TAB on the right, and click Add below.

File select this:

* Note: Do not mix libglu32.a with libglut32.a.
Open, “Keep Relative Path”, “No”, OK all the way, then F9 can run the program.
Also, if you don’t need ifdef in the sample program, you can simply do this:

If you want to use this library in the future, just include GL/ Glut.h.
The result should be this:

The main difference with VC and VS is that the library file is libglut32.a instead of other.lib files, so all we need to do is convert glut32.lib to libglut32.a. There is a program on SourceForge that can do this, but I can’t find it now, so just download it.
Relevant documents please go to my personal page: http://alanzjl.sinaapp.com/2015/02/opengl_in_codeblocks/
Or: http://download.csdn.net/detail/alanzjl/8463847 to download


Read More: