Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-771

Import of .pro ignores opengl32 and does not replace QTDIR

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 2.5.0 (rev.07), 2.5.1
    • 2.4.3
    • General
    • None
    • Windows
    • 351ae44ce76ef18a07e3bff551b720146a2d6637

      If QT += opengl is present, importing a .pro file containing a reference to opengl32.lib will generate a VS project without a reference to that library, which will lead to "unresolved external symbol" errors when linking against it.

      Also, paths to the Qt installation directory are not replaced in the project file with $(QTDIR), as expected.

      foo.pro
      QT += opengl 3dquick
      LIBS += -lopengl32
      SOURCES += foo.cpp
      
      foo.cpp
      #include <windows.h>
      #include <gl/GL.h>
      
      int main(int, char *[])
      {
          return (int)glGetError();
      }
      
      Output from Build

      1>------ Rebuild All started: Project: foo, Configuration: Debug x64 ------
      1>Reading Qt configuration (D:\lib\Qt\5.13.2\msvc2017_64\bin\qmake.exe)
      1>Generate moc_predefs.h
      1>foo.cpp
      1>foo.obj : error LNK2019: unresolved external symbol __imp_glGetError referenced in function main
      1>debug
      foo.exe : fatal error LNK1120: 1 unresolved externals
      1>Done building project "foo.vcxproj" – FAILED.
      ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

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

            mecfc Miguel Costa
            mecfc Miguel Costa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes