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,
Undefined reference”
The question:
http://www.mingw.org/wiki/HOWTO_Use_Mark_J_Kilgards_OpenGL_Utility_Toolkit_GLUT_with_MinGW
http://blog.csdn.net/huys03/article/details/2260949
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:
#define GLUT_NO_WARNING_DISABLE
I hope you found this article useful.
Read More:
- Create an OpenGL project in codeblock
- Codeblock configuring OpenGL
- The introduction of third-party jar package in mavn project results in classnotfoundexception
- OpenGL learning — problems encountered in compiling OpenGL program for the first time
- Configuring OpenGL environment with code blocks16.0 in Windows 10
- A series of problems in configuring OpenGL development environment in vs2015
- Configuring OpenGL in Code:: blocks
- The solution of configuring OpenGL in vs2017
- The solution of using OpenGL’s Glu Library in qt5.2 under win7
- Configure OpenGL in CodeBlocks
- Configuring OpenGL in Chinese version of VS2010 and problem solving
- Configuring OpenGL in VS
- Lost in computer OPENGL.dll
- Problems encountered in running OpenGL
- Summary of problems encountered in compiling opengl code
- 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
- Some configuration problems of OpenGL in VS2008
- [graphics] exceptions in downloading and installing OpenGL in vs2017
- Wechat third party authorization to generate QR code API
- Some problems and solutions in learning opengl in vs2017