Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

adding boost libraries



  • HI guys,,
    can anybody kindly suggest me to solve this problem i.e. already i have build boost libraries & added paths into project although im getting these errors in .pro file

    error: cannot find -lboost_random
    :-1: error: cannot find -lboost_system
    :-1: error: cannot find -lboost_date_time
    collect2.exe:-1: error: error: ld returned 1 exit status

    .pro file

    ONFIG(debug, debug|release):DEFINES +=DEBUG=1
    INCLUDEPATH += $$PWD/../../external/include
    DEPENDPATH += $$PWD/../../external/lib/boost
    CONFIG(release, debug|release): LIBS += -L$$PWD/../../external/lib/boost/ -lboost_random
    else:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../external/lib/boost/ -lboost_random

    CONFIG(release, debug|release): LIBS += -L$$PWD/../../external/lib/boost/ -lboost_system
    else:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../external/lib/boost/ -lboost_system

    CONFIG(release, debug|release): LIBS += -L$$PWD/../../external/lib/boost/ -lboost_date_time
    else:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../external/lib/boost/ -lboost_date_time


  • Moderators

    Print value of $$PWD/../../external/lib/boost/ to verify that the path is correct. Make sure that libboost_random.so is in that folder.



  • libboost_date_time-vc110-mt-gd-x64-1_68
    libboost_date_time-vc110-mt-x32-1_68
    libboost_date_time-vc110-mt-x64-1_68
    libboost_date_time-vc110-mt-gd-x64-1_68
    already i have these libraries in the folder


  • Moderators

    Clearly, there is no boost_random and boost_system in the list you provided. So no wonder qmake can't find them.

    Please make sure the libs are where you tell qmake/ linker to look for them.



  • i had given you just one example, out of 4 errors
    i have libboost-system , libboost-random and libboost-date_time


  • Moderators

    @Bharth said in adding boost libraries:

    i had given you just one example, out of 4 errors
    i have libboost-system , libboost-random and libboost-date_time

    OK, but you keep mixing the names. You have to make sure that names of your libraries and their inclusion in project file matches. It can't just "look a bit similar". It has to be the same name, down to every character.

    The only thing that -l flag will do, is to add "lib" in front of the string, and ".so" at the end on unix platforms, and on Windows it will only add ".lib" at the end.

    So:

    -lboost_date_time expects boost_date_time.lib, not libboost_date_time-vc110-mt-gd-x64-1_68. Modify your project file for these strings to match, or provide the library name directly (see the docs).



  • libboost_date_time-vc110-mt-gd-x64-1_68
    libboost_date_time-vc110-mt-x32-1_68
    libboost_date_time-vc110-mt-x64-1_68
    libboost_date_time-vc110-mt-gd-x64-1_68

    want me to give in this name boost_date_time.lib for all the above????


  • Moderators

    @Bharth said in adding boost libraries:

    want me to give in this name boost_date_time.lib for all the above????

    I don't understand what you mean.

    What you need to do is to change your project file so that the -l flags describe your .lib files exactly. The names must match. How you do it does not matter. You can rename the .lib files or change the name in .pro file.


Log in to reply