Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-500

MinGW: undefined reference to OpenGL libraries

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 1.2.0
    • 1.1.0
    • General
    • None
    • *OS*: Windows 7 x64 Service Pack 1.
      *Qt*: 5.2.0
      *Qt Creator*: 3.0.0
      *Qt Creator QBS Plugin*: 3.0.0
    • f4b6d84baa16440812127099f7b03ec79f87bd2a

    Description

      test.qbs

      import qbs.base 1.0
      Application
      {
          Depends { name: "cpp" }
          Depends { name: "Qt"; submodules: ["gui", "widgets", "opengl"] }
          name: "test"
          files: ["main.cpp"]
      }
      

      main.cpp

      #include <QApplication>
      #include <QGLWidget>
      
      class Renderer : public QGLWidget
      {
      protected:
          void resizeGL(int w, int h)
          {
              glViewport(0, 0, w, h);
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          Renderer win;
          win.show();
      	
          return app.exec();
      }
      

      Compilation output:

      compiling main.cpp
      linking test.exe
      C:/Qt/Tools/mingw48_32/bin/g++.exe -m32 -O2 -Wall -Wextra D:/test-build/qtc_Desktop_Qt_5_2_0_MinGW_32bit-release/.obj/test/main.cpp.o -o D:/test-build/qtc_Desktop_Qt_5_2_0_MinGW_32bit-release/test.exe -LC:/Qt/5.2.0/mingw48_32/lib -lqtmain -lQt5Core -lQt5Gui -lQt5OpenGL -lQt5Widgets
      D:/test-build/qtc_Desktop_Qt_5_2_0_MinGW_32bit-release/.obj/test/main.cpp.o:main.cpp:(.text$_ZN8Renderer8resizeGLEii[__ZN8Renderer8resizeGLEii]+0x24): undefined reference to `_imp__glViewport@16'
      collect2.exe: error: ld returned 1 exit status
      Process failed with exit code 1.
      The following products could not be built for configuration qtc_Desktop_Qt_5_2_0_MinGW_32bit-release: test.
      

      But qmake compiles it successfully using equivalent .pro file:

      QT       = core gui widgets opengl
      TARGET   = test
      TEMPLATE = app
      SOURCES  = main.cpp
      

      and produses next output:

      g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\test.exe release/main.o  -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmain -LC:\Qt\5.2.0\mingw48_32\lib -lQt5OpenGL -lQt5Widgets -lQt5Gui -lQt5Core
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            arhad Oleg Yarigin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes