qt with glut/freeglut
-
Hey guys im trying to get glut working with opengl but getting this error
The program has unexpectedly finished
Im using windows 10 qt 5 and freeglut for mvc3.0 and visual c++
QT += core gui opengl LIBS += opengl32.lib -glu32 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = qtopengl2 TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 SOURCES += \ glwidget.cpp \ main.cpp \ mainwindow.cpp HEADERS += \ glwidget.h \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target win32:CONFIG(release, debug|release): LIBS += -LD:/ufilesD/freeglutMSVC/freeglut/lib/x64/ -lfreeglut else:win32:CONFIG(debug, debug|release): LIBS += -LD:/ufilesD/freeglutMSVC/freeglut/lib/x64/ -lfreeglut INCLUDEPATH += D:/ufilesD/freeglutMSVC/freeglut/include DEPENDPATH += D:/ufilesD/freeglutMSVC/freeglut/include LIBS += -LGLU
-
You need to put
freeglut.dll
next to your executable file.Anyway, do you really need freeglut? It's very old and outdated. Qt already has built-in everything freeglut offers and more. It would be a lot easier to just use QOpenGLWidget.
-
Ok I have added it the freeglut.dll file into qtbuilds directory but still getting the program has unexpectedly finished.
and yea i just wanna get it working
i added the x64 from this folder
D:\ufilesD\freeglutMSVC\freeglut\bin\x64INCLUDEPATH += D:/ufilesD/freeglutMSVC/freeglut/include DEPENDPATH += D:/ufilesD/freeglutMSVC/freeglut/include # currently removed -lfreeglut and just left freeglut # because -lfreeglut is when the file is libfreeglut.dll win32:CONFIG(release, debug|release): LIBS += -LD:/ufilesD/freeglutMSVC/freeglut/lib/x64/ -lfreeglut else:win32:CONFIG(debug, debug|release): LIBS += -LD:/ufilesD/freeglutMSVC/freeglut/lib/x64/ -lfreeglut LIBS += -LGLU
i rearranged the pro file
i tried to use the debugger to the main.cpp on i see these segmentation fault
-
Ok I have added it the freeglut.dll file into qtbuilds directory
I said you need to put that dll next to the executable. From what I see in your output window the executable is in
qtbuilds/debug/
folder, so place the dll there, not one directory up. -
Hi,
Did you check that you have all dependencies required for the freeglut .dll if any ?