Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Boost + Qt installation problem (cannot find -lboost_system)
QtWS25 Last Chance

Boost + Qt installation problem (cannot find -lboost_system)

Scheduled Pinned Locked Moved Installation and Deployment
boostqtcreator
4 Posts 2 Posters 4.5k Views
  • 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.
  • I Offline
    I Offline
    ion_knight
    wrote on 27 May 2015, 15:49 last edited by ion_knight
    #1

    Ok currently having a problem using boost with Qt.

    Boost was built as complete, so contains all the files needed to work (.a,dll.a,dll)
    Alt text

    As you can see it contains lots of liboost system libraries. All with the correct build version (built using QT creators mingw version - 491_32.

    Inside my .pro file i've included the locations of the boost folder along with the library location.

    QT       += core
    QT       -= gui widget
    
    TARGET = Testing_Exif
    CONFIG   += console
    CONFIG   -= app_bundle
    
    INCLUDEPATH += C:\releases\lib\boost\Qt\boost_1_58_0
    
    LIBS += -LC:\releases\lib\boost\Qt\boost_1_58_0\stage\lib\ \
            -lboost_system
            -lboost_thread
    TEMPLATE = app
    
    SOURCES += main.cpp \
        EXIF.cpp
    
    HEADERS +=  EXIF.h
    

    Compiler Output listed below:

    C:/Qt/Qt5.4.1/Tools/mingw491_32/bin/../lib/gcc/i686-w64-mingw32/4.9.1/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lboost_system
    collect2.exe: error: ld returned 1 exit status
    Makefile.Debug:80: recipe for target 'debug\Testing_Exif.exe' failed
    mingw32-make[1]: *** [debug\Testing_Exif.exe] Error 1
    

    As you can imagine not really sure where to go from here, as have to use boost no matter what.

    For a test example I have created a single very basic file that just contains:

    QCoreApplication a(argc, argv);
    const boost::filesystem::path inputFileName = "C:\\Users\\Nick.CSM3D\\Documents\\Qt\\Testing_Exif\\ROOS_JUDY_RT.jpeg";
    return a.exec();
    

    Environment Paths:
    C:\Qt\Qt5.4.1\5.4\mingw491_32\bin;C:\releases\lib\boost\Qt\boost_1_58_0

    Anyone has a clue why I am not able to add -lboost_system (whether that be using its direct name, well one of them, or the name listed to the left). If anyone has an idea where I am going wrong that would be great.

    If anyone has an idea where I should go from here that would be great

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 27 May 2015, 16:07 last edited by mcosta
      #2

      The problem is that LIBS += -lboost_system tries to link a library named libboost_system.<version>.dll.

      In your case you have the platform naming mgw49 that differs from what the linker expect.
      You can either:

      • rebuild boost without platform information (IIRC there's a flag to do this but I don't remember exactly the name)
      • add the platform information to the LIBS like LIBS += =lboost_system-mgw49-mt-1_58

      UPDATE: The flag to control the library naming should be --layout. To remove compilers, tools in the library name you should use --layout=system

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      I 1 Reply Last reply 27 May 2015, 16:44
      0
      • M mcosta
        27 May 2015, 16:07

        The problem is that LIBS += -lboost_system tries to link a library named libboost_system.<version>.dll.

        In your case you have the platform naming mgw49 that differs from what the linker expect.
        You can either:

        • rebuild boost without platform information (IIRC there's a flag to do this but I don't remember exactly the name)
        • add the platform information to the LIBS like LIBS += =lboost_system-mgw49-mt-1_58

        UPDATE: The flag to control the library naming should be --layout. To remove compilers, tools in the library name you should use --layout=system

        I Offline
        I Offline
        ion_knight
        wrote on 27 May 2015, 16:44 last edited by
        #3

        Ah thanks for the help mcosta that was it, didn't realise that i still had to use "-lboost" instead of "-libboost". Is there any reason why they aren't the same as the filename itself ?

        Also cheers for layout stuff should make my life easier for later.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on 28 May 2015, 04:45 last edited by
          #4

          Hi,

          library naming is something OS related (for instance the filename for a dynamic library called foo on Windows with Visual Studio will be foo.dll, on Linux libfoo.so, on OS X libfoo.dylib).

          For this reason when you pass the library name to the linker you have to omit the prefix (ususally lib) and the extension.

          NOTE in case of MinGW you'll have the naming conventions used in Linux/Unix (lib<library_name>.<extension>)

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0

          3/4

          27 May 2015, 16:44

          • Login

          • Login or register to search.
          3 out of 4
          • First post
            3/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved