Boost 1.47 link with QtCreator2.5



  • Hi, I have searched all the posts about Boost but still cannot fix my problem...
    I just want to use Boost library only, but suffering on it.

    My Steps:

    1. Install boost : sudo port boost.
      it installed header files and library files into /opt/local/include and /opt/local/lib
    2. create a C++ project in QtCreator2.5
      testing code
      @
      #include <iostream>
      #include <boost/asio.hpp>

    int main ()
    {
    return 0;
    }
    @
    pro file is
    @
    TEMPLATE = app
    CONFIG += console
    CONFIG -= qt

    INCLUDEPATH += /opt/local/include #I add this
    LIBS += -L/opt/local/lib #I add this

    SOURCES += main.cpp
    @

    And then I built, the result is
    @
    make: Entering directory /Users/qinsisi/test/timer' g++ -headerpad_max_install_names -arch i386 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o 01_timer.app/Contents/MacOS/01_timer main.o -L/opt/local/lib ld: warning: ignoring file main.o, file was built for unsupported file format which is not the architecture being linked (i386) Undefined symbols for architecture i386: "_main", referenced from: __start in crt1.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status Undefined symbols for architecture x86_64: "boost::system::system_category()", referenced from: __static_initialization_and_destruction_0(int, int)in main.o boost::asio::error::get_system_category() in main.o "boost::system::generic_category()", referenced from: __static_initialization_and_destruction_0(int, int)in main.o "boost::asio::error::get_netdb_category()", referenced from: __static_initialization_and_destruction_0(int, int)in main.o "boost::asio::error::get_addrinfo_category()", referenced from: __static_initialization_and_destruction_0(int, int)in main.o "boost::asio::error::get_misc_category()", referenced from: __static_initialization_and_destruction_0(int, int)in main.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/20/20d5ly4n7qv3d61_30dd5x180000gn/T//ccfhHDpX.out (No such file or directory) make: *** [01_timer.app/Contents/MacOS/01_timer] Error 1 make: Leaving directory/Users/qinsisi/test/timer'
    03:39:24: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project 01_timer (target: Desktop)
    When executing step 'Make'
    @

    I have tried to do this,
    macx:CONFIG -= x86
    macx:CONFIG -= x86_64
    but failed.

    i also tried to right click on project and go to "Add Library"
    I tried "external Library" and "system library", but I cannot see /opt/local/ folder so that i cannot select the directories.

    Anyway, thanks in advance.



  • "Example from documentation":http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#libs
    @
    unix:LIBS += -L/usr/local/lib -lmath // you don't have -l
    win32:LIBS += c:/mylibs/math.lib
    @


Log in to reply
 

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