GLFW 3 initialized, but no?

I am struggling with creating a window with the GLFW 3 function, glfwCreateWindow. I installed an error callback function that pretty much just prints the error number and description, and according to this, the GLFW library was not initialized, although the glfwInit function just returned success?

Here is an example from my code

// Error callback function prints out any errors from GFLW to the console static void error_callback( int error, const char *description ) { cout << error << '\t' << description << endl; } bool Base::Init() { // Set error callback /*! * According to the documentation this can be use before glfwInit, * and removing won't change anything anyway */ glfwSetErrorCallback( error_callback ); // Initialize GLFW /*! * This return succesfull, but... */ if( !glfwInit() ) { cout << "INITIALIZER: Failed to initialize GLFW!" << endl; return false; } else { cout << "INITIALIZER: GLFW Initialized successfully!" << endl; } // Create window /*! * When this is called, or any other glfw functions, I get a * "65537 The GLFW library is not initialized" in the console, through * the error_callback function */ window = glfwCreateWindow( 800, 600, "GLFW Window", NULL, NULL ); if( !window ) { cout << "INITIALIZER: Failed to create window!" << endl; glfwTerminate(); return false; } // Set window to current context glfwMakeContextCurrent( window ); ... return true; } 

But what is printed in the console

 INITIALIZER: GLFW Initialized succesfully! 65537 The GLFW library is not initialized INITIALIZER: Failed to create window! 

I think that I am getting an error due to the fact that the setting is not entirely correct, but I did everything I could with what I could find in the place.

I downloaded Windows 32 from glfw.org and stuck in 2 files from it to minGW / include / GLFW, files 2.a (from the lib-mingw folder) to minGW / lib and the DLL, also from the lib-mingw folder, on Windows / System32

In code :: blocks, I have, from the assembly settings → the linker settings, connected to the 2..a files from the download. I believe I need to connect more things, but I can understand what, or where I should get these things.

+4
source share
2 answers

I tried reinstalling the code blocks and mingw that solved the problem.

It seems that GLFW3 does not like to install previous versions at the same time for some reason, so if someone has a similar problem, you can try this.

+4
source

I ran into similar issues in Cocos 3.8.1 and 3.10. I never installed code blocks or mingw, so there was no point in installing them for me.

The GLFW.lib file in the cocos directory is out of date.

http://www.glfw.org/download.html and replace the lib file in your project with the latest one and it may solve your error.

0
source

Source: https://habr.com/ru/post/1488873/


All Articles