Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAbstractOpenGLFunctions, QOpenGLFunctions_2_0 linker errors

QAbstractOpenGLFunctions, QOpenGLFunctions_2_0 linker errors

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 3.8k Views 1 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
    Grisha
    wrote on last edited by
    #1

    Hi, I've recently attempted to switch to 5.1, and use the QAbstractOpenGLFunctions method of getting OpenGL extensions. I'm trying out QOpenGLFunctions_2_0 for now, just to start off, and everything compiles fine. I'm trying to build a 32-bit app in MSVC 2012 on windows 7.

    The problem is the linker throws an error for every single QOpenGLFunctions_2_0 function I attempt to use. I've tried including every single debug .lib file I could, and still get the linker error. What .lib should I have/link against to make this work?

    Thanks!

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      Hi, hmm this sounds weird. Can you paste the exact output please? Also maybe post the relevant piece of code too.

      Thanks

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Grisha
        wrote on last edited by
        #3

        Sorry for the late reply, I was not in the office during the weekend.

        I recreated this issue by starting a new project using the new QT project interface in VS2012. Here is the error:

        test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QOpenGLFunctions_2_0::glUniformMatrix4fv(int,int,unsigned char,float const *)" (_imp?glUniformMatrix4fv@QOpenGLFunctions_2_0@@QAEXHHEPBM@Z) referenced in function "public: __thiscall test::test(class QWidget *)" (??0test@@QAE@PAVQWidget@@@Z)

        Here is the relevant piece of code (it does nothing, just demonstrates the problem):
        #include "test.h"

        #undef QT_OPENGL_ES_2
        #include <qopenglfunctions_2_0>

        test::test(QWidget *parent)
        : QMainWindow(parent)
        {
        ui.setupUi(this);

        QOpenGLFunctions_2_0* Func = dynamic_cast<QOpenGLFunctions_2_0*>(QOpenGLContext::currentContext()->versionFunctions());
        Func->glUniformMatrix4fv(0, 0, false, NULL);

        }

        test::~test()
        {

        }

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

          Hi,

          Looking at the "QOpenGLFunctions":http://qt-project.org/doc/qt-5.0/qtgui/qopenglfunctions.html documentation, it seems that you are not using QOpenGLFunctions the correct way. There might be the problem

          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
          • Z Offline
            Z Offline
            ZapB
            wrote on last edited by
            #5

            All of the QOpenGLFunctions_<MAJOR>_<MINOR>[_PROFILE] classes are part of the QtGui library. Are you sure you are linking to QtGui?

            To obtain and initialise the functions object I usually use code like this:

            In class declaration:
            @
            QOpenGLFunctions_2_0* m_funcs;
            @

            In implementation, typically in some init function:
            @
            // Assumign you have a current QOpenGLContext
            m_funcs = m_context->versionFunctions<QOpenGLFunctions_2_0>()
            if (!m_funcs)
            qFatal("Could not obtain OpenGL 2.0 functions");
            m_funcs->initializeOpenGLFunctions();

            // Then use it
            m_funcs->glUniformMatrix4fv(...)
            @

            Nokia Certified Qt Specialist
            Interested in hearing about Qt related work

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

              Yes, I double checked just now and I was indeed linking against QtGui. Also to be sure I tried linking against every .lib in the bin directory, and the error persists. My QT context is a downloaded 5.1.0 binary for windows 7, x86, msvc2012.

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on last edited by
                #7

                Can you post a small compilable example that I can use to try to reproduce the problem please?

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  Grisha
                  wrote on last edited by
                  #8

                  Here is a link to a google drive shared rar file with the whole project:
                  https://docs.google.com/file/d/0B0z5KZUIEVmXbjZvZkc3SkhtTUk/edit?pli=1

                  In this case, I've set the project file to point to the downloaded binary version of QT (qt-windows-opensource-5.1.0-msvc2012-x86-offline.exe) I installed. I've also been compiling various QT versions, and found that when I compile QT myself, this problem disappears, so I can just use that for now if this is a low priority problem.

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    ZapB
                    wrote on last edited by
                    #9

                    Ah I think I see the issue. I think you are using a version of Qt compiled against ANGLE which only provides OpenGL ES 2 compatibility rather than full OpenGL.

                    Please try one of the pre-compiled packages that has "opengl" in the filename.

                    Nokia Certified Qt Specialist
                    Interested in hearing about Qt related work

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      Grisha
                      wrote on last edited by
                      #10

                      Thanks, that solved my issue.

                      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