Tag Archives: codeblocks

Configuration of OpenGL under CodeBlocks and solutions to problems encountered

The configuration process: https://blog.csdn.net/sophiale07/article/details/44965875
Undefined reference to ‘_XX OpenGL function name ‘.
Solution:
Add before include precompile directives that include OpenGL

 #define _STDCALL_SUPPORTED

 
If it still doesn’t work, add

#define _M_IX86  
#define GLUT_DISABLE_ATEXIT_HACK  

There may also be warnings, which can be removed by the following code:

#define GLUT_NO_WARNING_DISABLE

Modify the compilation and Makefile methods for undefined reference errors.
https://blog.csdn.net/huys03/article/details/2260949

Configure OpenGL in CodeBlocks

There are many online tutorials, but some are easy to use and some are not.
There are two broad categories. One is that you don’t have to manually add libraries after you’ve configured them, but a New GLUT Project is needed to create a New Project instead of the usual Console Application. This category can refer to this document: https://wenku.baidu.com/view/7396dc8783d049649b66588c.html
Another type of configuration method, when configured, will be a New normal Console Application, but you will need to manually add the OpenGL library.
I chose the second category because I found that the console could not be tuned out of the configuration method of the first category, so I could not see the output of the console. Debug is very inconvenient, so I haven’t found a solution yet.
General reference is http://www.yalewoo.com/opengl_notes_2_use_opengl_in_codeblocks.html, but is not identical also, built after the project need to add one more libraries.

Steps:
Glut. h goes into the MinGW\include\GL directory of the compiler. .
glut32 lib in MinGW \ lib directory
glut32. The DLL into the C: \ Windows \ System in

Open the codeblocks create the console program, and then in the project to build the options – would add three static link library glut32 Settings. The lib, libopengl32. A, as well as libglu32. A, their paths in the lib folder of the compiler.

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

CodeBlocks configuring OpenGL

Download Windows environment GLUT, link: https://pan.baidu.com/s/1U43rth8-9W6AcP2zG3GFRw password: i2zu
Glut.h, Glut32.dll, LibGlut32.a, MSVCR70.dll

The following directory is mine, the specific operation pay attention to their own installation directory

1. Put Glut. h in F:\Program Files\ Codeblocks \ MingW \ Include \GL
2. Put libglut32.a in F:\Program Files\CodeBlocks\MinGW\lib
3. Place glut32. DLL in C:\Windows\System32 for 32-bit OS and C:\Windows\ Syswow64 for 64-bit OS
Then create a GLUT project

Then specify the GLUT location (this is just my location, notice your installation directory).

Online other people’s tutorials tutorials may be so far, but I have the following problems

You should start the code with a #include< windows.h> OK, but it looks like it’s going to be above the sentence GLUT


The last problem is an error that says “because msvcr70.dll……….. cannot be found” C:\Windows\System32 or C:\Windows\SysWOW64. These two directories should be the difference between 32-bit and 64-bit systems

CodeBlocks environment error the compiler could not find a solution to the problem

Problem description:
Recently, I reinstalled Codeblocks, and found that after I entered it, an environment error window always pops up in the lower right corner, indicating that the compiler cannot be found, as shown in the figure:

Here’s the solution:
First is the best one to the address of the official download codeblocks:

http://www.codeblocks.org/downloads/26 – – – note!!!!!!!!!!
here’s the crux of the matter! Make sure you download the MinGW version (the fourth in the figure) :

. After you download and install the MinGW option, you will see the

Once you open Codeblocks after installation, there will be no pop-up boxes!
There’s always a safe bet:
If the previous prompt is also displayed after opening, it may be in Settings -&gt because you changed the path in Settings compiler. compiler-> Toolchain executables changes the path (can auto-detect) to do the job: