Unsolved Qt GLFW and GLEW setup
-
GLFW already provides a mean to build their library. Use it.
-
And who to built it. I just find the way to use it in VS.
-
Please, read the documentation of the libraries you want to use. It's explained right in their website.
-
-
Other thing is that at glfw\lib-mingw-w64 there is 3 files
glfw3.dll
libglfw3.a
libglfw3dll.athese are libarys so I assume that I could include that so right click add external libary I add: libglfw3.a
.pro file
TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt SOURCES += main.cpp INCLUDEPATH += C:\glfw\include win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../glfw/lib-mingw-w64/ -lglfw3 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../glfw/lib-mingw-w64/ -lglfw3d else:unix: LIBS += -L$$PWD/../../../../glfw/lib-mingw-w64/ -lglfw3 INCLUDEPATH += $$PWD/../../../../glfw/lib-mingw-w64 DEPENDPATH += $$PWD/../../../../glfw/lib-mingw-w64
So it looks good but when I try to build the program I get errors
:-1: error: cannot find -lglfw3d :-1: error: collect2.exe: error: ld returned 1 exit status
-
@bence said in Qt GLFW and GLEW setup:
error: cannot find -lglfw3d
I don't know whether it would give rise to that error message, but I do not see either a
.dll
or a.a
having that trailingd
in its name. When using MSVC, debug libraries have ad
on the end of their name, but I don't think that is the convention when usinggcc
/mingw
. So are you using a linker line designed for MSVC with a build using MinGW? -
@JonB said in Qt GLFW and GLEW setup:
MSVC
At C:\glfw\lib-vc2019 there is 3 files glfw3.dll glfw3.lib glfw3dll.lib
At C:\glfw\lib-mingw-w64 there is 3 files glfw3.dll libglfw3.a libglfw3dll.a I am using this libary but I getting error I know that there is no d in name I add external libary I add libglfw3.a and I disable Mac and Linux platform and I also disable Add d suffix for debug version
lib-mingw-w64 there is nothing related to MSVS I guess
.pro
TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt INCLUDEPATH += C:\glfw\include win32: LIBS += -L$$PWD/../../../../glfw/lib-mingw-w64/ -lglfw3 INCLUDEPATH += $$PWD/../../../../glfw/lib-mingw-w64 DEPENDPATH += $$PWD/../../../../glfw/lib-mingw-w64 SOURCES += main.cpp
I get 32 errors
undefined reference to `__imp_CreateDCW' undefined reference to `__imp_GetDeviceCaps' undefined reference to `__imp_DeleteDC'
....
-
@bence
The 3 unreferenceds you list come from WinGDI. You would need to link against something linkGdi32.lib
for these, which I suspect you are not doing. Or, I don't know, those leading__imp_
s might indicate you are still somehow trying to link against MSVC libraries.In fact I even see a stackoverflow post covering this for GLFW MinGW link error, which you should read through and follow. It says MinGW has a library
libgdi32.a
for these. -
@JonB But there is no Gdi32.lib file in the folder
And if I just use the following code
int main(void) { if (!glfwInit()) return -1; return 0; }
It still not woriking
-
-
The only thing that I did is I add two file. I assume that I just have to do that.
.pro file
TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt INCLUDEPATH += C:\glfw\include SOURCES += main.cpp win32: LIBS += -L$$PWD/../../../../glfw/lib-mingw-w64/ -lglfw3 INCLUDEPATH += $$PWD/../../../../glfw/lib-mingw-w64 DEPENDPATH += $$PWD/../../../../glfw/lib-mingw-w64 win32: LIBS += -L$$PWD/../../../../MinGW/lib/ -lgdi32 INCLUDEPATH += $$PWD/../../../../MinGW/include DEPENDPATH += $$PWD/../../../../MinGW/include win32: LIBS += -L$$PWD/../../../../MinGW/lib/ -lopengl32 INCLUDEPATH += $$PWD/../../../../MinGW/include DEPENDPATH += $$PWD/../../../../MinGW/include
-
It looks like you are mixing two different MinGW installations.