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. [SOLVED] GLEW linking errors with Qt Creator 2.5.2
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] GLEW linking errors with Qt Creator 2.5.2

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 8.9k 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.
  • Chris KawaC Offline
    Chris KawaC Offline
    Chris Kawa
    Lifetime Qt Champion
    wrote on last edited by
    #2

    This works for me:
    @
    INCLUDEPATH += "C:/foobar/glew-1.10.0/include"
    LIBS += -L"C:/foobar/glew-1.10.0/lib/Release/Win32" -lglew32
    @
    You don't need tpo explicitly link to opengl32 (and glu I think). Qt + opengl does that for you. You also don't need to add lib folder to INCLUDEPATH, no headers there. If you're not building glew everytime you don't need the DEPENDPATH either.
    Remember to re-run qmake (Build->run qmake) after changes in .pro file so it will pick up new directories.

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

      I modified my .pro to have just those 2 lines you posted but I'm still getting the same linking errors. Is there something that I may be missing externally? Or could there be a possibility that other packages be conflicting with the linking?

      And I constantly run qmake with every change made

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

        Not that I know of.
        Just to be sure - build or rebuild is not the same as running qmake.
        What compiler are you using - MinGW or VC and which version?

        Offtopic question - why still Creator 2.5.2? It's very old. Current version is 3.1.0

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

          I believe I'm using MinGW. I don't know how to check the version. I obtained my current version of MinGW from installing QtSDK at this "link":http://download.cnet.com/Qt-SDK/3000-2069_4-75305206.html

          Addressing your off topic question -
          I'm using Creator 2.5.2 because I believe that's what my Graphics class used last year. I tried using Creator 3.1.0 but I didn't understand how a kit worked and how to install one. I just wanted to continue my project from last year right away and over time, switch to Creator 3.1.0

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

            Actually, it's better to say my tool chain has auto-detected both MinGW (as a GCC for Windows targets) and MSVC Visual C++ Compiler 12.0. But when I'm compiling, it's using mingw32-make.exe

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

              Hm, I might be wrong, but aren't the binaries distributed with GLEW incompatible with MinGW? I think you need to compile GLEW from source using MinGW.

              The SDK you have is also quite old. The best way to install all you need is usually via online installer directly from "Qt downloads page":http://qt-project.org/downloads
              It will allow you to select a version and compiler you want and will set up kits and all the stuff for you.
              A kit is actually just a collection of tools in the chain needed for development: a compiler, debugger and a Qt library packed in one, named configuration that you can select when creating project.

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

                Thanks for the explanation on a kit. I went and installed the "Qt Online Installer":http://qt-project.org/downloads, and was surprised that everything was set up for me.

                So now I believe I'm running the latest Qt Creator, which came with the installer. I'm now running the following:

                • Compiler: MinGW 4.8 32bit
                • Qt 5.2.1

                I'm still getting the same errors.

                You also mentioned about the binaries distributed with GLEW may be incompatible with MinGW. How do I compile GLEW from source using MinGW, and what does that do?

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

                  Yeah, the binaries (dll and lib files) are built with some old version of VC (not sure which) and it seems they don't play well with MinGW.

                  Download the "source package":https://sourceforge.net/projects/glew/files/glew/1.10.0/glew-1.10.0.zip/download of GLEW
                  If you don't know how to compile it look around on the web. I can't give you specific instructions since it's been a while since I used GLEW and MinGW together, but it should be as easy as setting some environment variables and running mingw32-make with some options.

                  What it does - it creates libraries compiled by and compatible with MinGW ;) You see the .dll file in the bin folder and .lib in the lib folder? The .lib one is the one you use with the LIBS entry in your .pro file, the .dll is needed at runtime and you distribute it with your app.
                  Compiling with MinGW will create these (except the .lib one will have .a extension, that's the "native" format of MinGW).

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

                    I was just thinking - do you really need GLEW at all? Qt has pretty nice OpenGL supporty built in and it can resolve all the function pointers just as GLEW does.
                    You can just subclass QOpenGLFunctions_4_3_Core (or whichever OpenGL version you want to target) and use OpenGL inside it like you would normally.

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      graphicsnewb
                      wrote on last edited by
                      #11

                      Thanks for the explanations. And I did not know about the class QOpenGLFunctions. I checked it out and it has the same function calls from GLEW. This is amazing! I will be away from my main computer for a few days so I'll test it out once I get back.

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        graphicsnewb
                        wrote on last edited by
                        #12

                        Okay, so I have completely abandoned GLEW in favor for "QGLFunctions":http://qt-project.org/doc/qt-5/qopenglfunctions-4-3-core.html and it is now working. If anyone else is interested, here is how part of my code is set up:
                        @#include <QGLWidget>
                        #include <QOpenGLFunctions_4_3_Core>
                        #include "readOBJ.h"

                        class GLDisplay : public QGLWidget, protected QOpenGLFunctions_4_3_Core
                        {
                        public:
                        GLDisplay(char *, QWidget *parent = 0);
                        void createOBJ(char *);
                        GLuint loadShaders(const char *, const char *);
                        @

                        Also, it appears that in order to use QOpenGLFunctions_4_3_Core, you have to call "setSurfaceType":http://qt-project.org/doc/qt-5/qwindow.html#setSurfaceType(OpenGLType) from the QWindow class. Otherwise, Seg Faults will occur.

                        If QOpenGLFunctions is used instead, then this is not necessary, but QOpenGLFunctions lack certain functions that _4_3_Core has (i.e. glGenVertexArrays() to set up VAO).

                        Thanks again Chris.

                        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