Results 1 to 13 of 13

Thread: Boost: use it with Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Posts
    13
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Boost: use it with Qt

    I cannot express how much time I've wasted over the last few weeks trying to get shit work with boost.

    Anyway, I'm trying to setup boost with Qt Creator right now, and I'm having linking issues.

    I've built my boost libraries for MinGW using:
    Qt Code:
    1. b2 --build-dir=build toolset=gcc --build-type=complete stagegcc
    To copy to clipboard, switch view to plain text mode 

    Now, I've added the following lines to my .pro:
    Qt Code:
    1. LIBS += -L"c:/boost_1_47_0/stagegcc/lib/"
    2. INCLUDEPATH += c:/boost_1_47_0/
    3. DEPENDPATH += c:/boost_1_47_0/
    To copy to clipboard, switch view to plain text mode 

    I'm using boost's ASIO library, which needs boost::system library
    when I try to compile my project I get the error:
    Qt Code:
    1. undefined reference to 'boost::system::generic_category()'
    To copy to clipboard, switch view to plain text mode 

    I've read several threads about how to get boost to work with Qt, but none of them helped so far.
    Also, I'm relatively new with Qt, last time I used it was 2 years ago for one project, so please be detailed in your instructions.

    I HATE boost right now.
    No success at all configuring it with Code::Blocks
    Managed to make it work with MSVC just to discover that it doesn't work with c++/cli so I cannot make any GUIs.

    Thank you

  2. #2
    Join Date
    Sep 2010
    Location
    Nagpur, India
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Boost: use it with Qt

    I too faced same problem couple of years ago while working on application using Qt and boost together.

    I worked by defining QT_NO_KEYWORDS macro (this will prohibit using Qt's signals and slots keywords which clashes with Boost) and then used Q_SIGNALS, Q_SLOT instead of Qt's signals and slots keywords while declaring in header file. You
    http://www.boost.org/doc/libs/1_49_0...gnals/s04.html

    Hope that helps.

    Jainish

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Boost: use it with Qt

    You are not linking against boost, you just told your compiler where to look for it but you didn't tell it to actually look for it. Add a LIBS += -l<libname> entry to your project file. By the way... What Boost ASIO does, Qt already does. So maybe it's easier to just port your code to Qt to get rid of the additional dependency.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Jul 2010
    Posts
    13
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Boost: use it with Qt

    Thanks for the replies,

    I've added:
    LIBS += -lboost_system-mgw46-mt-1_47\
    -lboost_thread-mgw46-mt-1_47

    and
    #define BOOST_THREAD_USE_LIB
    to my source file

    Now I simply get "collect2: ld returned 1 exit status", no details...
    This is bad

    I'm slowly considering the option of dropping boost altogether now...

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Boost: use it with Qt

    You surely get more than this obscure message.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QT Roadmap considering Boost and C++0x
    By frank100 in forum Newbie
    Replies: 3
    Last Post: 19th January 2011, 20:59
  2. Qt and Boost in the same C++ program?
    By TriKri in forum Qt Programming
    Replies: 12
    Last Post: 9th May 2010, 22:58
  3. Howto use Qt with Boost ?
    By bilgenratte in forum Qt Programming
    Replies: 3
    Last Post: 1st October 2009, 14:12
  4. Boost libraries
    By steg90 in forum General Programming
    Replies: 26
    Last Post: 13th June 2007, 12:50
  5. boost::assign
    By Sivert in forum General Programming
    Replies: 0
    Last Post: 2nd May 2007, 00:23

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
  •  
Qt is a trademark of The Qt Company.