I use QT Creator 4.2.1, glew-2.0.0.

There is main.cpp

#define GLEW_STATIC 1 #include <GL/glew.h> #include <GLFW/glfw3.h> int main(void) { GLFWwindow* window; /* Initialize the library */ if (!glfwInit()) return -1; /* Create a windowed mode window and its OpenGL context */ window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); if (!window) { glfwTerminate(); return -1; } /* Make the window's context current */ glfwMakeContextCurrent(window); glewInit(); /* Loop until the user closes the window */ while (!glfwWindowShouldClose(window)) { /* Render here */ static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f}; glClearBufferfv(GL_COLOR, 0, red); /* Swap front and back buffers */ glfwSwapBuffers(window); /* Poll for and process events */ glfwPollEvents(); } glfwTerminate(); return 0; } 

There is also a .pro file

 TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt SOURCES += main.cpp LIBS += -L"C:/Software/Programming/glew-2.0.0/lib/Release/Win32/" -lglew32 -lGLFW3 -lopengl32 -luser32 -lgdi32 

Dll file glew.dll threw in system32, lib and include folders with the corresponding folders in the directory mingw.

Build a project does not work, the following is displayed:

 C:\projects\Qt\QMAKE_TEST\main.cpp:30: ошибка: undefined reference to "__glewClearBufferfv" 

What is the problem and what am I doing wrong?

  • In general, there is no point in using QT together with GLFW - these libraries both provide cross-platform window creation (in the case of QT in addition, there is still a lot of everything, since this is a framework). So the advice is to choose one thing ... you don't even need glew if there is a QT , since it can work from OpenGL out of the box - ampawd

1 answer 1

Solved the problem by replacing the -lglew32 library with -lglew32s.

  • 2
    It would be nice if they wrote why it helped. - vp_arth
  • @vp_arth most likely due to the fact that the application is statically linked ( #define GLEW_STATIC 1 ) and you just -glew32s - ampawd