Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. qt with glut/freeglut
Forum Updated to NodeBB v4.3 + New Features

qt with glut/freeglut

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
7 Posts 3 Posters 5.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gtx0908
    wrote on last edited by Chris Kawa
    #1

    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
    

    0_1566537395659_progunexp.PNG

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      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.

      1 Reply Last reply
      2
      • G Offline
        G Offline
        gtx0908
        wrote on last edited by gtx0908
        #3

        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\x64

        INCLUDEPATH += 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

        0_1566753812319_segfaultopengl.PNG

        0_1566753845161_debug1.PNG

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          1
          • G Offline
            G Offline
            gtx0908
            wrote on last edited by gtx0908
            #5

            but that is where i put it

            0_1566769194972_location.PNG

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gtx0908
              wrote on last edited by
              #6

              anyone able to figure out a way to dot his i still cannot do it

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                Did you check that you have all dependencies required for the freeglut .dll if any ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved