Configuring OpenGL with VS is of course quick and smooth, but I prefer to write small programs with lightweight Codeblock, and as a novice to Codeblock, it took me a long time to figure it out
Codeblock already has some OpenGL header files and.a library files, but they are not comprehensive and GLUT is missing. So I downloaded the “full version” that someone else had cobbled together to use. The configuration steps are as follows:
(1) Unpack OpenGL into a folder, which usually contains an include folder containing header files and a lib folder containing lib files, or simply mix the header files and lib files into a folder.
(2) Open Codeblock and click Settings->; Open a dialog box, click New on the second line, enter the name of the variable you like, mine is OpenGL, press OK, then in the left side of the base column to fill in the directory where OpenGL is located, mine is D:\MyWorkSpace\ openGL_sdk, in the include column and lib column to fill in as follows. In short, provide the directory where the header and lib files are located. If all the files are mixed together, the three paths can be the same. Finally, click Close.
(3) If you want only one Project to be able to detect OpenGL’s directory, then click Project-> on the existing Project; Build Option; If you want all projects to be able to detect the OpenGL directory, click Settings->; Complier. Then go to the Search Directories TAB and Add a $(#OpenGL)\include column in the Comier TAB below, and a $(#OpenGL)\lib column in the Linker TAB next to it. Go to the Linker Settings TAB above, press Add below to Add all the lib files in the OpenGL directory (the number of files may not be the same as mine, NO matter), and then press “OK” or “No” in the dialog box that pops up. Finally press OK.
(4) Compiling and linking. At this point, if there are no problems, congratulations, the configuration is complete. However, maybe some people like me are suffering from a problem, compiler error, something like:
Filename reference to ‘__ ‘
Error messages in this format are usually caused by a failure to link the LIB file, so at first I thought the MINGW compiler could not use LIB, but only A files, so I went back to the MINGW utility and tried to convert LIB to A files, but it didn’t work and generated a DLL. And even weirder on my roommate’s machine, it generates obj. It didn’t seem to happen to anyone else on the Internet, so I didn’t find a solution for it for a long time, so I decided to ditch it. After a long search, I finally found two articles that said,
My in containing the include OpenGL precompiled instruction before increase # define _STDCALL_SUPPORTED success, maybe others’ not yet, in order to insurance, you can write:
#define _STDCALL_SUPPORTED #define _M_IX86 #define GLUT_DISABLE_ATEXIT_HACK
Remember to put it in front of the header file code that contains OpenGL. You can remove the warning by adding the following code in the previous position:
I hope you found this article useful.
- Configuring OpenGL environment with code blocks16.0 in Windows 10
- Configuring OpenGL in Chinese version of VS2010 and problem solving
- Vs compiling OpenGL project, the solution of unable to open the source file “GL / glaux. H” appears
- Configuring OpenGL in Code:: blocks
- The solution of using OpenGL’s Glu Library in qt5.2 under win7
- Configuring OpenGL with win 10 + CodeBlocks
- Using glut in CodeBlocks
- Error in header file when calling OpenGL to open obj file in vs2013: unable to open include file: “GL / glut. H”: no such file or directories
- The first day of OpenGL [vs2017 + OpenGL environment configuration]
- CodeBlocks configuring OpenGL
- A series of problems in configuring OpenGL development environment in vs2015
- CodeBlocks OpenGL configuration process
- Create an OpenGL project in codeblock
- Error: unable to open include file: ‘GL / glut. H’
- Configure OpenGL in CodeBlocks
- Vc2010 configuring OpenGL environment
- Configuration of OpenGL under CodeBlocks and solutions to problems encountered
- Summary of problems encountered in compiling opengl code
- The solution of configuring OpenGL in vs2017
- |-OpenGL – | some small problems about the glut Library