Summary of problems encountered by CodeBlocks + OpenGL

1. Explore the installation software, configure OpenGL, the key is where the several files of GLU are placed, and how to set up the link library for the new project.
2. Try to run the code for the class
#include< #include< iostream> and # include< stdio.h> #include < #include < GL/gl.h> And # include & lt; GL/glut.h> needs to replace include < GL/ogl.h> . Not familiar with OpenGL header files.
3. Summary of Mistakes:
1.error:assignment of read-only variable 'S_width'
2.error:initializer element is not constant
The initializer element is not constant error occurred during compilation. Problem: The value of a global variable cannot be determined at compile time, but must be determined at execution time (compile principle). That is, the global variable should be declared outside the function, and the assignment should be done inside the function. Solution: Declare the variable name externally and assign the value inside the function.
3. The codeblocks warning: ignoring # pragma comment {- Wunknown - pragmas}
Problem: see online is the way mingw use MSVC will issued a warning: ignoring # pragma comment - Wunknown - pragmas reason is that, under the GCC with # pragma comment (lib, "ws2_32") equivalent prepared statements. Solution: Toolbar -->; The Project - & gt; Build Options, select Linker Settings, and Add the statically linked library files you need
opengl32.lib/ code>
ned reference to OpenGL
> Look at the net summary reasons have a lot of, I did not put the library link.
5. Use Codeblocks to create header files. You can refer to this article
https://blog.csdn.net/qq_40741513/article/details/80858910 click File> > New> > Build target> > Files> > C/C++header > > go
Go to codeblocks, file->; So addfile, add the.h file that you created.
uses "" when including header files, for example: "header.h". Because & lt; > "" is used to include the compiler's own header files, "" is used to include your own header files.
#ifndef header.h
define header.h...
#define header.h...
#endif prevents duplication of definitions, or if you do not use the header multiple times. "Header. H" is generally the upper case name of the HEADER file
6. There is exit was not declared in this scope , undefined reference to WinMain @ 16 'collect2. Exe: error: ld returned 1 exit these problems
Try to experiment the code on the net, after debugging in the computer run, feel very happy.
learning
Codeblocks DLL is what folder (https://blog.csdn.net/kld1412/article/details/51628424) codeblocks CPB is what files. .cbp(Codeblocks Project) Codeblocks Project OpenGL Profile Resources Download This is all but integral enough (https://download.csdn.net/download/blink31/4376444) in AutoCAD and interactive environment modelling and so on3dmax, users can use the mouse drag form on a computer screen to do 3 d any degrees of freedom of rotation, the user can observe the form the geometry characteristics of the different sides. This user-friendly technology is ---- Trackball technology.
Example problem record:
1. Drawing the classroom globes:

F:\test\earth\src\earth.cpp|84|error: no matching function for call to 'std::basic_ifstream<wchar_t>::basic_ifstream(const wchar_t*&)'|

To be solved
2 Code::Blocks : undefined reference to xxxxxx@4'
Reason: lack of lib library. Solution: Add a lib library.
3. about console file stdafx.h. refer to this blog post
The solution is to copy this stack of code into your new "stdafx.h", and then
Just put it in the same directory as your source files.
initializer element is not constant itializer element is not constant. Change to #define using the method described here, but error 2 appears above. No solution has been found to the problem.
5. The use of glaux
Learning Resources:
1.OpenGL simulation of solar system running
2.OpenGL drawing rotating teapot
. Use OpenGL to do a clock animation
4. Use OpenGL to achieve a bouncing ball
Learning website
https://learnopengl-cn.github.io/

Read More: