I didn’t use the C/C++IDE Codeblocks, so I downloaded it for homework, but found it couldn’t compile, let alone run it.
What’s going on with this condition?
See next prompt, original is no compiler!!
found that I had downloaded and installed a version without a compiler. Unfortunately, I also had no other compiler installed on my computer.
>
>
My solution is to uninstall and reinstall!
This program cannot be started because the computer is missing COpenGL.dll
1. Baidu search and download COpenGL. DLL, which generally contains two versions of 32 bit and 64 bit.
2. At first, I added this 32-bit COpenGL. DLL to C:\Windows\System32, but nothing happened. C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin (My VS installation path)
(First blog, more to come
)
Solution to the problem that OpenGL can’t find glew32.dll in vs2019
#define GLEW_STATIC
#define GLEW_STATIC
#define GLEW_STATIC
#define GLEW_STATIC
#define GLEW_STATIC
#include < GL/glew.h>
#include < GLFW/glfw3.h>
#include
# pragma comment (lib, “glew32. Lib”)
int main() {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Open GLFW Window
GLFWwindow* window = glfwCreateWindow(800, 600, "My OpenGL Game", NULL, NULL);
if (window == NULL)
{
printf("open window failed");
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Init GLEW
GLboolean glewExperimental = true;
if (glewInit() != GLEW_OK)
{
printf("init GLEW failed");
glfwTerminate();
return -1;
}
glViewport(0, 0, 800, 600);
while (!glfwWindowShouldClose(window))
{
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
Glew32.dll
1
1
1
1
1
1
br>
> You need to enter the C disk with admin privileges, then put a copy of glew32.dll into C:\Windows\SysWOW64, the problem is fixed, the window appears
Using the third party OpenGL in codeblock
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.
Solutions to various inexplicable errors after QT compilation
1. Delete the Debug and Release folders of the project
2. Delete ****. Pro. user file
C:\Users\” YourPath “\AppData\Local\QtProject\QtCreator\ Cache
C:\Users\” YourPath “\AppData\ QtProject\ QtCreator
[PCL + QT + vs] no override found for ‘vtkrenderwindow’ error resolution
override found for 'vtkrenderWindow'
<>ode> > code> c>>>
main.cpp
/ code>>
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
Vtk7. X is compiled and installed under vs2013 and vs2015
First of all, we need to prepare the required documents, which are as follows:
(1) cmake, download link cmake download. As for what CMAKE is, I will not introduce it, so a book, want to say it is hard to say. If you look at the suffix,.msi and.zip, you may wonder “what’s the difference?” In my opinion, zip is more convenient than msi.
(2) VTK file, divided into Source file and Data file. Download link VTK download link. Click the download link and you will see the picture.
Download zip files for source and zip files for data. Since I’m using VS here, I don’t need to download Python.
After downloading, it is decompressed. I used to decompress the files extracted from Data into the files extracted from Source. I stressed that I decompressed them separately, that is, decompressed them into two folders.
Two, start compiling
(1) Create a new folder in the folder after source unzipped, habitually named build, this folder is used to put the project related files after cmake.
(2) Open cmake
The source code bar is the path after unzips the source, and the build bar is the path of the project generated by CMAKE. The bin folder in the picture is not what I said above, so you can change the destination path to the build folder you created.
If you want to create a 64-bit VTK, you need to select the 64-bit VSXuan option. If you want to create a 64-bit VTK, you need to select the 64-bit VSXuan option
(3) Make the file options, the specific meaning of the options I will not say
This is the item that should be checked in Build.
This is the cmake group, but watch out for CMAKE_INSTALL_PREFIX. This is a very important one. You’ll notice that most of the blogs don’t talk about it at the moment, but it will make it much easier to use VTK.
Then is the intall road strength configuration, as shown below:
Represent the DLL path, the LIB path, and the VTK header path compiled with VS respectively. You need to set it up by yourself. In the future, you can use VTK just like OpenCV.
Because I’m using MFC, check the module_vtkguisupportMFC in the Module. Other options seem to be the default.
(4) Click the Configure button, and when the red color turns to white, click the Generate button to Generate the project.
Note: If there is an error when cmake is checked, it may be because the VS installation path has Chinese. Therefore, it is specially reminded that the installation path in Chinese should not appear.
(5) Finally, click Open ProJeroject to open the generated project in VS. As shown in figure:
Compile all_build, only install if successful.
While I’m using VS2015, other VSs do the same, I need to remind you that there is one more step you need to take before VS2013 is compiled, and that is to install multiple character sets.
The result after successful compilation is shown in the figure below:
As for the use, and you are familiar with the use of OpenCV is the same.
Because everyone’s level is different, I don’t know if it’s clear or not. If there is a lack of documents, or what questions can be left in the blog question, we discuss together.
And finally, the aforementioned book:
These are books about learning VTK, ITK, and CMAKE. Please leave a comment below if you need any.
Three possibilities of “unhandled exception: 0xc0000005: access conflict when reading location 0x00000000”
1 “data out of bounds or defined pointer not freed.
2: Null Pointers are most likely. It is best to explicitly assign values before using Pointers!
should be a pointer problem
3 “memory access error, check the pointer, whether empty, whether out of bounds, etc
CMake_ Compiling VTK_ 9.0.0 running vtkcommoncolor DLL has access conflict
https://blog.csdn.net/weixin_42291376/article/details/105745115 in this place Here also thanks to the original blogger
0x00007FF8959AD270 (VTKCommonColour 9.0.dll) Exception: 0xC0000005: Access conflict occurs when reading position 0x0000009469200000.
ah
Then check to post an article
https://blog.csdn.net/qq_42641977/article/details/107687726.
linker – input – attached dependency 9.0.lib suffix has been removed.
There is an unhandled exception at: 0xc0000005: an access conflict occurred while reading location 0x00000000.
turn
First, exclude a small probability event that is caused by system conflict. For example, if there is a similar third-party library file in the system disk directory, the program will crash and report an error of 0xC0000005: access conflict occurs when reading position 0x00000000.
You’re paying a value to a variable that shouldn’t be assigned, or you’re paying a value to a variable (or constant) that can’t be paid.
(1) The simplest and most straightforward error is probably the problem with scanf(). We all know that scanf(“% format “,& Variable), then in addition to the string (you can call & , but not), all input is required & If you lose it, you won’t be able to find it on many compilers when it’s mutated, meaning it’s not wrong, but the reason why it’s wrong is because the input data is written as scanf(“% format “, variable), so you don’t know where the input variable will be stored.
(2) Null pointer assignment.
We know that if a pointer is empty can’t directly to his assignment, the reason is null Pointers don’t know what the dow was, so he has no fixed memory, now you give his assignment, popular point to understand is that he don’t know how to save, also don’t know what there is, will not be stored, but now you have a need to let him storage, then it will appear afore-mentioned problems, then the solution is to apply for space (using malloc or new), or you try to avoid him to become a null pointer, or when he has become the possibility of a null pointer, you can discuss separately.
Here are a few examples of what is possible:
int * p = 0;
int * p = 0;
p[0] = 100;
of course, it can’t be that obvious in actual code, this is just one example, may be similar, this is you have a good look at yourself, the above 0 and NULL is actually the same, that is, NULL pointer assignment.
a=(double*)malloc(sizeof(double)*6);
h =…
a[0]=h;
First of all you don’t know if malloc is going to succeed or not and if it fails it happens to return NULL and normally you can allocate this amount of memory and it won’t fail but as you said after a couple of loops you might not be free or you might run out of memory or you might fragment and malloc fails and you don’t know so the exact problem is that you assign a NULL pointer to an exception
The following three Pointers are available online: You can compare them with your own:
1:
ar *p;
p = new char[number];
delete [] p;
…
// always using p…
p = xxx; // access violation
2:
char *p;
memcpy(p, xxx, number); // access violation
3:
char *p;
p = new char[number];
delete [] p;
…
delete [] p; // access violation
0xC0000005: Access Cheesecake error debug —
Add a word:
No problem (1) compile time
(2) the runtime is a loop calculation, set breakpoints, before a few cycle are no problem, to which a certain cycle (end of cycle conditions have not reached) will appear these problems.
You must be assigning the null pointer somewhere in the middle of the step.
(3) Array or pointer out of bounds
As long as it is related to memory is basically possible, of course, array or pointer out of bounds, this is also very common, this will not give examples, I believe that everyone can understand what consciousness, also know how to solve, this requires you to be more careful and careful.
Bug resolution of 0xc0000005: access conflict occurred when reading location of 0x00000000.
Error cause:
There’s a section in the program called cout <; < string; //char string[] But didn't notice that string can also be NULL, This leads to errors. Error analysis: When string is a null pointer, cout calls strlen to get the length of the string before printing it. So you need to access the null pointer (that is, the memory address of 0), and once the program accesses this memory, the system raises an exception, thus reporting an error.
Summary of OpenGL simple solar system simulation
I am completely a beginner, with reference to the “OpenGL Introduction Tutorial” this document and some references on the network can be scraped together to complete this simple solar system model. (here to thank the makers of this tutorial and the sharer, I feel to write quite good, there is a download on the Internet, I am from baidu library to get, they also passed a to the resources) why is the solar system model?Because I love it, and a lot of people have done it, and I don’t understand it, but there’s a code to learn. Needless to say, the first on a renderings:
The starting point of any project should be a requirement analysis. The requirement is very simple, which is to display a model that looks like the solar system on the screen, and just look like it. It takes time and effort to make an accurate model of the solar system, and no one pays for it. Then the design phase, as object-oriented programming, look for the object, the eight planets in the solar system as well as the sun itself, in order to look more beautiful point, track should also be mapped, so the object has two, all objects to achieve a draw method, is used to draw themselves, to design a myObj parent class can be easily performed as part of the paint job, I think now that each orbit to a certain object, then the track can be used as a private attribute of the object, it should be a dependency. The class diagram is as follows:
The basic information for the star ASTER includes the radius of the star, the revolution period revolution_solar, the revolution period self, the orbit orbit, and the revolution radius distance. Orbit has only one radius property. There are also some auxiliary properties that are defined in the implementation and are not listed in the class diagram.
With the class diagram, you can enter the coding stage, the first need to configure the development environment, I am using VS2010, development is using OpenGL, download address Baidu Google, I do not remember the original download address, passed a copy to the resources inside. Tutorial there said to be integrated development libraries to vs inside, but I don’t like it, don’t often use it is not necessary to change the development environment, as long as it is good to set a single project, the DLL file to the operation of the generated files,. H file saved to the project folder,..lib file loaded in the code should be able to use relative paths, but I don’t know where the base path is temporarily, so chose to set the attributes of the project, particular way is:
Right-click the project name in the Solution Explorer and select Properties ->; Linker-> General, add an absolute lib directory to Additional Librarydirectories. The lib file is loaded using #pragma comment (lib).
There are many examples in the tutorial, and each knowledge point is also very clear, do not repeat. Inside I met a little problem when system is realized in lesson 5 day month, if you use the tutorial to the parameters of the inside, in the window is what also can’t see, but if I ten times to reduce the parameters of the unified, can appear normal, though I searched some articles of coordinate transformation, but at present still don’t know why will appear this problem, if such as morally scaling should not appear different results?Doesn’t OpenGL accept parameters that are too large?
Said a little bit about the questions about the gluLookAt function, may be my personal problem, in understanding the function of the time a little effort, this function has nine parameters, divided into three groups, the first group is about the viewpoint of movement, a viewpoint is initially at point (0, 0), if not after the perspective projection transformation of coordinates, then draw the images will appear in the view’s location, similar to someone put something in your eyes, things just don’t see behind, can move through the first coordinate, then draw the solution to the object, But the advantage of Glulookat is that you don’t have to calculate the position of every object. You can view it from any Angle. It doesn’t matter if you just plot on the plane of the xyz axis, but what if you want to see the whole system at 45 degrees or 75 degrees?The position of each object is not easy to calculate. The way I understand this function works is that the developer first draws the whole system in the coordinate system, and then realizes the change of observation Angle through this function, and OpenGL automatically calculates the relative position of each object. This function must be placed before the other coordinate changes, and I feel that it is executed in the last order of the system drawing. The above is irresponsible conjecture, without any theoretical support, hereby declare…
Well, going a bit too far, the second set of parameters are the coordinates of the center of the viewpoint. The perspective projection itself is a four-prism, and the line between the viewpoint and the center is the same as a perpendicular from the vertex to the bottom.
The third parameter is the direction, that is, what do you think of the observer, the tutorial says from the point of (0, 0) to the point of attachment to determine positive direction, such as if set to (0, 0), is similar to normal viewing screen, (0, 1, 0) means the person is in upside down the screen, (0, 0, 1) said looked down at the keyboard, (0, 1) said from behind the display looked down at the keyboard…
There are still some problems with lighting and material Settings, we will talk about it later. The whole project has been uploaded to resources, please download it if necessary.
The first time you set up the project, you mistakenly selected Windows Application, which can be found in Properties ->; Linker-> system-> Subsystem changes to Console.
Modify the icon of the Console program to add resource->; Open Resource. H and set the ID of your icon to a minimum. To open Resource. H, open the.rc file (select View Code) and then open it in an include< file. resource.h> Select Open Document.