Qt 64 bit hides its libraries



  • I am working on a program which I have been kicking around for three years.
    It is a desktop application for calculating orbits of satellites and while
    I used MinGW-make and the g++ from MinGW I could easily develop it in Eclipse
    by looking up the Qt libraries during the link phase.

    So then I wanted to do it 64bit.

    I have downloaded several different forms of Qt 64bit. None of them want to
    make their libraries accessible to g++. At the moment I have
    qt-opensource-windows-x86-msvc2015_64-5.8.0.exe

    Here is a simple example of code that Qt has suggested for a console app :


    // Horse.cpp

    #include "D:/Qt64/5.8/msvc2015_64/include/QtCore/qcoreapplication.h"

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    return a.exec();
    

    }

    a self-written makefile was used : makefile.Release
    and it is read by MinGW32-make

    g++ is D:/MinGW/64/bin/g++
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Some parts of my makefile.Release :

    QTDIR = D:/Qt64/5.8/msvc2015_64
    HORSEO = D:/Projects/Horse/obj/Release/horse.o

    justobj:
    @echo just compile
    g++ -c -std=gnu++11 -I'$(QTDIR)/include' -I'$(QTDIR)/include/QtCore' -o $(HORSEO) $(PRJ)/src/Horse.cpp

    justlink: $(HORSEO)
    @echo just link
    g++ -Wl,-subsystem,windows -mthreads -o $(PRJ)/bin/Release/Horse.exe $(PRJ)/obj/Release/Horse.o -L$(QTDIR)/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmain -lQt5Widgets -lQt5Core -lQt5Gui
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    the results : compiling Horse.cpp to Horse.o is no problem at all, the header file is visible and accessible

    ......BUT..... if I call g++ to link....

    MinGW32-make -f makefile.Release justlink
    just link
    g++ -Wl,-subsystem,windows -mthreads -o D:/Projects/Horse/bin/Release/Horse.exe D:/Projects/Horse/obj/Release/Horse.o -LD:/Qt64/5.8/msvc2015_64/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmain -lQt5Widgets -lQt5Core -lQt5Gui
    D:/Projects/Horse/obj/Release/Horse.o:Horse.cpp:(.text+0x35): undefined reference to __imp__ZN16QCoreApplicationC1ERiPPci' D:/Projects/Horse/obj/Release/Horse.o:Horse.cpp:(.text+0x3e): undefined reference to__imp__ZN16QCoreApplication4execEv'
    D:/Projects/Horse/obj/Release/Horse.o:Horse.cpp:(.text+0x50): undefined reference to __imp__ZN16QCoreApplicationD1Ev' D:/Projects/Horse/obj/Release/Horse.o:Horse.cpp:(.text+0x67): undefined reference to__imp__ZN16QCoreApplicationD1Ev'
    collect2.exe: error: ld returned 1 exit status
    makefile.Release:41: recipe for target 'justlink' failed

    You may say I must check my path to the libraries...well, here is a screen shot.
    Exactly at D:/Qt64/5.8/msvc2015_64/lib is the file QtCore.lib. But I can't access it.
    You may say I should use QtCreator. No thanks. It doesn't link there either.
    What is going on here? Must I add some other option flags??


  • Moderators

    Look closly: qt-opensource-windows-x86-msvc2015_64-5.8.0.exe. This is a package for Visual Studio 2015, not MinGW.
    For MinGW Qt only provides 32bit precompiled binaries. It's the qt-opensource-windows-x86-mingw530-5.8.0.exe package. If you want to use 64bit MinGW you need to download Qt's sources and compile it yourself.



  • when you say "compile it yourself", do you mean to take the qt-everywhere-opensource-src-4.8.4.tar.gz and do the things with it?


  • Moderators

    No, qt-everywhere-opensource-src-4.8.4.tar.gz is Qt 4.8.4, very very old, for Linux, don't use it. The easiest way to get the sources is through the online installer. If you prefer an offline package use this one. You can also get sources directly from git. The last link also contains instructions for how to build Qt. In (very) short it's:

    • Get the sources
    • Setup the environment (compiler and libraries paths)
    • configure <options>
    • make (or equivalent for your compiler)
    • make install


  • thank you muchly. this is has been bugging me for two weeks. I'll try it out what you suggested. I have heard of a 'git' before.



  • What now?

    I had this thing building for two hours and then it stopped and complained about opengl something.

    In file included from ../../include/QtGui/qopengl.h:1:0,
    from d:/Qt64/qt-source/qt5/qtbase/src/gui/kernel/qopenglcontext.h:60,
    from ../../include/QtGui/qopenglcontext.h:1,
    from d:/Qt64/qt-source/qt5/qtbase/src/gui/kernel/qplatformintegration.h:56,
    from ../../include/QtGui/5.9.0/QtGui/qpa/qplatformintegration.h:1,
    from D:/Qt64/qt-source/qt5/qtbase/src/gui/accessible/qaccessible.cpp:52:
    d:/Qt64/qt-source/qt5/qtbase/src/gui/opengl/qopengl.h:109:26: fatal error: GLES2/gl2.h: No such file or directory
    compilation terminated.
    Makefile.Debug:13802: recipe for target '.obj/debug/qaccessible.o' failed
    mingw32-make[4]: *** [.obj/debug/qaccessible.o] Error 1
    mingw32-make[4]: Leaving directory 'd:/Qt64/qt-build/qtbase/src/gui'
    Makefile:40: recipe for target 'debug-all' failed
    mingw32-make[3]: *** [debug-all] Error 2
    mingw32-make[3]: Leaving directory 'd:/Qt64/qt-build/qtbase/src/gui'
    Makefile:576: recipe for target 'sub-gui-make_first' failed
    mingw32-make[2]: *** [sub-gui-make_first] Error 2
    mingw32-make[2]: Leaving directory 'd:/Qt64/qt-build/qtbase/src'
    Makefile:44: recipe for target 'sub-src-make_first' failed
    mingw32-make[1]: *** [sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'd:/Qt64/qt-build/qtbase'
    Makefile:78: recipe for target 'module-qtbase-make_first

    should I go back an run configure with -opengl??



  • @Rapidrain -opengl desktop is the correct form.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.