Category Archives: How to Fix

How to configure OpenGL on CodeBlocks

No such file or directory. This error is still present in the C++project. Hey, that’s weird!
The compiler path is set to the path of the NTL library. Now it does not need the NTL library.
Method: the link to delete the NYL library can be

Reproduced in: https://www.cnblogs.com/pualus/p/5900937.html

Some configuration problems of OpenGL in VS2008

1. Just for the first time today in VS2008 using OpenGL, configuration when met some problems, then checked the online to find a better way to site at: http://blog.csdn.net/joven0/article/details/7639715. Most of them are correct, but there is something wrong with the download address of GLEW given by the author. The downloaded file does not have DLL file and lib file. Later, I searched the Internet and found a relatively complete program zip package. Click to download the zip package.
You can’t start this program because GLUT32. DLL is missing from your computer. You can put GLUT32. DLL together with the exe file of this program, but I don’t know why this works.
Today I write here, later if you have any questions to supplement.
Added: Later, I got some advice from one of my classmates, because my system is 64-bit, so glut32.dll should be placed in the folder SysWOW64. Later, I put glut32.dll file in this file and the problem was solved.

Xcode configuring OpenGL

Xcode configuration OpenGL
Link GLFW
Download the source files, http://www.glfw.org/download.html
compilation Open a terminal, type the command line

cmake .
sudo make install

Compiles displays library paths, such as:
Installing:/usr/local/lib/libglfw3. A

<>sr /local/include/>

the source file: http://glew.sourceforge.net/ zip is ok

make
sudo make install
make clean

This is going to be a slow step
Sudo make install on Mac OS X EI Capitan
install -d-m 0755 “/usr/include/GL”
stall: mkdir /usr/include: Operation not permitted
m>: * [install.include] Error 71
This is because, starting with El Capitan, Mac OS X has enabled System Integrity Protection, which no longer allows direct access to directories under /usr, except /usr/local, so you need to install GLEW under /usr/local. GLEW’s Makefile will be changed to GLEW_DEST?= /usr = GLEW_DEST?Sudo make install = /usr/local
Then link some Framework
Cocoa, IOKIT, CoreVideo, and the generated libglfw3.a

Configuring OpenGL environment on Mac OS

OpenGL environment is configured under Mac OS system
1. Prepare resources
CLToolsglewlibGLTools.
a
file can be downloaded in baidu network backup, link: https://pan.baidu.com/s/13gkpLWjbKSBNFnA-IGo23A password: g3b5
2. Create a project

3. Import the system Framework
Import OpenGL. Framework and Glut. Framework.

4. Add prepared resources
Drag the include file down into the project;
Drag the libgltools.a file into the Framework group under your project;
Add glew.h and gltools.h Paths to Header Search Paths.

5. Delete the unwanted files and create Main.cpp
Delete AppDelegate.swift, ViewController.swift, and if there are any main.m files, delete them as well.
create main.cpp file, do not check “Also create a header file”.

6. Compile
If you encounter a compilation error, import mode from the system library to <; > Change to plain file to introduce "".
test as follows:


#include "GLShaderManager.h"
#include "GLTools.h"
#include <GLUT/GLUT.h>

GLShaderManager shaderManager;

GLBatch triangleBatch;

void changeSize(int w,int h)
{
    glViewport(0, 0, w, h);
}

void RenderScene(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
    
    GLfloat vRed[] = {1.0,1.00,0.0,0.5f};
    
    shaderManager.UseStockShader(GLT_SHADER_IDENTITY,vRed);
    
    triangleBatch.Draw();
    
    glutSwapBuffers();
}

void setupRC()
{
    glClearColor(0.3f, 1.0f, 1.0f, 1);
    
    shaderManager.InitializeStockShaders();
    
    GLfloat vVerts[] = {
        0.0f,0.8f,0.0f,
        0.5f,0.0f,0.0f,
        -0.5f,0.0f,0.0f
    };
    
    triangleBatch.Begin(GL_TRIANGLES, 3);
    triangleBatch.CopyVertexData3f(vVerts);
    triangleBatch.End();
    
}

int main(int argc,char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH|GLUT_STENCIL);
    glutInitWindowSize(600, 400);
    glutCreateWindow("Triangle");
    glutReshapeFunc(changeSize);
    glutDisplayFunc(RenderScene);
    GLenum status = glewInit();
    if (GLEW_OK != status) {
        
        printf("GLEW Error:%s\n",glewGetErrorString(status));
        return 1;
        
    }
    setupRC();
    glutMainLoop();
 
    return  0;
    
}

Write about the problems and solutions when configuring OpenGL in vs2015

1. LNK2019 cannot resolve the external symbol _VSPRINTF, which is referenced in the function _PrintMessage
The problem seems to be that some functions in the add library are incompatible with the functions provided in VS, and additional dependencies need to be set
Specific solutions are as follows
Add a line of code under #include

#pragma comment(lib, "legacy_stdio_definitions.lib")

2. LNK2019 cannot parse the external symbol _main, which is used in the function “int __cdeclinvoke_main(void)” (?invoke_main@yahxz) is referenced

This is because the program does not have a main function, so the link fails. There are two ways to solve this problem: one is to write a main function as the entry point; The other is in the property page ->; The linker – & gt; On your system, change the first line from /subsytem:console to
/subsystem:windows

3. The arguments of type ‘char *’ participating in type ‘LPCWSTR’ are not compatible.
The argument of type “const char *” is not compatible with the parameter of type “LPCWSTR”.
This is due to the fact that VS2015 uses the Unicode character set. I have tried many methods to solve this problem for a long time, but the most convenient way to solve this problem is in the property page ->; In general, change the character set line from using the Unicode character set to using the multi-byte character set

DEVC + + configuring OpenGL

First of all, very, very important, don’t know what is my version of the problem was strange reasons, in a 64 – bit compiler under me, no matter use what method can’t configuration is successful, but under the 32-bit compiler success soon, so if you are completely in accordance with some online method to configure but can’t succeed, may first take a look at yourself in the compiler is 32 bits.
Glut. h in the GL folder of your compile environment include. Then put GLUT32.lib in any lib directory, and add the command -lopengl32-lglu32-lglut32 when connecting. Try replacing -lglut32 with “glut32.lib “as the path to the file /glut32.lib. It should work.
The following is my configuration :(ignoring that I installed DevC ++ in the folder downloaded from Baidu Cloud…
Above, you should be able to start using DevC ++ for OpenGL programming.


2018.11.19 update
Today, when I was helping my roommate configure the environment, I encountered a strange problem: the glut32.dll file was missing
I have already put glut32.dll in the System32 folder according to previous experience, but I can’t solve this problem… But after a bit of searching on Baidu, I found that for some reason I don’t know, I might need to put the file in the SysWow64 folder.

Lack of msvc120d.dll library

When the program is written and the executable also depends on the library to be migrated to another machine that does not have VS installed, the missing MSVC will be reported… DLL library problem, that’s because
If you’re writing an MFC program, you need to set it to statically import the MFC library. If you’re writing a Win32 program, you need to cancel the MFC library and select the standard library.
You also need to select the Release version, not the Debug version

The first time I write OpenGL program, what should I do when I encounter “can’t open include file:” GL / glaux. H “: no such file or directory”?

Recently, while learning the tutorial of Nehe, I use VS2010 as the learning and development platform.

I just copied the nehe code into the empty project I built. I was about to compile and run, but I did not expect to meet the “cannot open the included file:” glaux-h “: No such file or directory”! How to do?

So, I baidu.com, there is no relevant glaux file in the system.

Therefore, the solution is as follows:
1) Search and download GLAUX related files online
2) Copy glaux. DLL to C:\Windows\System32
3) Copy glaux.lib to C:\Program Files (x86)\Microsoft SDKS \Windows\v7.0A\ lib
4) Copy glaux. H to C:\Program Files (x86)\Microsoft SDKS \Windows\ V7.0 A\Include\ GL

Click Compile Run again, “Cannot resolve the external symbol __imp__glLoadIdentity@0, the symbol in the function” appears.

Once again baidu, originally, is not to join the related lib caused, so also in the code to add:
#pragma comment(lib,”opengl32.lib”)
#pragma comment(lib,”glu32.lib”)
#pragma comment(lib,”glut32.lib”)

Actually, I didn’t find glut32.lib on my computer, so I commented the “#pragma comment(lib,”glut32.lib”)”.

Click compile and run again, and the program finally runs. It’s a relief.

Solve the problem that the newly installed CodeBlocks cannot be compiled and run

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!





Configuring OpenGL environment with code blocks16.0 in Windows 10

The article directories
Download the Glut package, configure the environment, create a project and select File to create a new project, select Glut to fill in the project name and go to the Mingw folder in the root of your Codeblock directory and select Finish and add this header to your main file and it will run

One: Download the GLUT package
Download link
Two: Configure the environment
(1) Copy GLUT. DLL and GLUT 32. DLL from the GLUT package to C:\Windows\SysWOW64;
(2) : Copy Glut. h to MinGW\include\GL in the Codeblocks installation directory, for example: D:\ Codeblocks \MinGW\include\GL;
(3) : Copy Glut.lib, Glut32.lib to \MinGW\lib in the Codeblocks installation directory, for example: D:\CodeBlocks\MinGW\lib;
Three: the establishment of the project
Select File to create a new project, and select Glut

Fill in project name

Select the MinGW folder in the root directory where your codeblock resides

Select finish

Add this header to the main file and you’ll be ready to run

This represents that the environment is configured