Results 1 to 5 of 5

Thread: [win32, MinGW] Qt5 does not find external libraries that works in Qt4

  1. #1
    Join Date
    Dec 2007
    Location
    Ancona, Italy
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question [win32, MinGW] Qt5 does not find external libraries that works in Qt4

    Hello, I do my main development in Linux and time to time (years) I do a compilation in Windows.

    In my windows machine I had Qt 4.8 with gcc 4.6. I compiled, long time ago and using gcc 4.6, some external libraries and my old code works fine.
    Now I wanted to compile in windows my new code, that in the meantime has been ported to Qt5.
    So in the windows machine I installed, in an other folder, Qt5, that now comes shipped directly each version of Qt with its own MinGW. For example I have Qt5.2.1 with its DOS prompt set to work with gcc 4.8.

    My project uses some external libraries that have been compiled from source in windows using gcc 4.6 (and it was a mess, so I would really like to avoid to recompile them if possible).

    My qt project file instructs the linker to use them with the following lines:

    Qt Code:
    1. win32 {
    2. INCLUDEPATH += win32/include/coin
    3. INCLUDEPATH += win32/include/coin/ThirdParty
    4. INCLUDEPATH += win32/include
    5. INCLUDEPATH += win32/include/adolc
    6. INCLUDEPATH += $$[QT_INSTALL_DATA]/src/3rdparty/zlib
    7. LIBS += -L win32/lib -lipopt
    8. LIBS += -L win32/lib -lcoinmetis
    9. LIBS += -L win32/lib -lcoinmumps
    10. LIBS += -L win32/lib -lcoinhsl
    11. LIBS += -L win32/lib -lcoinblas
    12. LIBS += -L win32/lib -lcoinlapack
    13. LIBS += -L win32/lib -ladolc
    14. LIBS += -lpthread -lgfortran -lcoinmetis -lcoinblas
    15. CONFIG += exceptions
    16. }
    To copy to clipboard, switch view to plain text mode 

    The problem is that when I run make, I got, in Qt5, the following error:
    screenshot _qt5.jpg

    When I run the old software, with the same configuration and using the Qt4 prompt, I don't have instead any linking problem:
    screenshot_qt4.png

    Could it be a different way of including external libraries in a project in Qt5 compared to Qt4? Or because the external libraries have been compiled with gcc 4.6 and are hence not recognised by the gcc 4.8 used with the new Qt5 ??

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4

    On first screenshot I see "permission denied" error.

  3. #3
    Join Date
    Dec 2007
    Location
    Ancona, Italy
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4

    Here is a complete screenshot with the directory structure, the content of the .pro file and the link error (the first post didn't include the ThirdParty subdirectory, as it was one of the many tests I did). As you can see the lib files are there, and I am using a windows XP virtual machine with no particular permissions set.. and the Qt4 version, with an analogue structure, works.. Is it changed something in Qt5 compared to Qt4 in the way external libraries have to be declared in the project?

    Thank you very much and sorry to bother you..

    Screenshot from 2015-09-28 15:30:17.jpg
    Last edited by sylvaticus; 28th September 2015 at 15:38.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4

    You are using relative paths in your LIBS and building the code in a shadow build directory. It seems likely/possible that the libraries are not in the same relative location at link time. Try an absolute path
    Qt Code:
    1. LIBS += -Lc:/full/path/to/ThirdParty/...
    2. LIBS += -lipopt \
    3. -lcoinmetis \
    4. -lcoinmumps \
    5. ...
    To copy to clipboard, switch view to plain text mode 

    If the libraries have C++ interfaces then you will most likely have to build them again.
    Last edited by ChrisW67; 28th September 2015 at 22:38. Reason: spelling corrections

  5. #5
    Join Date
    Dec 2007
    Location
    Ancona, Italy
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4

    Thank you, setting the full path in -L works. I also solved a problem with zlib (Qt5 doesn't ship with it any more like in Qt4). Unfortunately my libraries, compiled with an older version of MinGW, crash, so I need to recompile them..

    Thank you

Similar Threads

  1. Replies: 4
    Last Post: 27th March 2012, 12:35
  2. MinGW can't find my libraries
    By cape in forum Newbie
    Replies: 8
    Last Post: 18th September 2011, 21:17
  3. Qt Creator Mingw can't find my libraries
    By cape in forum Qt Tools
    Replies: 0
    Last Post: 17th September 2011, 23:47
  4. Shadow build QT for the win32-g++ (MinGw) platform.
    By Avrohom in forum Installation and Deployment
    Replies: 0
    Last Post: 21st January 2009, 00:10
  5. Qt 4.3.3 MinGW (win32) - MMX/SSE/SSE2
    By pokey909 in forum Installation and Deployment
    Replies: 1
    Last Post: 17th January 2008, 08:19

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.