Results 1 to 4 of 4

Thread: Qt + boost + MinGW on Windows

  1. #1
    Join Date
    Jun 2008
    Posts
    49
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Qt + boost + MinGW on Windows

    I'm trying to create a build environment which would include Qt 4.3 and boost 1.35.0 on both Linux and Windows, using Eclipse CDT as a common IDE on both platforms. On Linux things are quite straighforward, one just installs Eclipse CDT, the Qt-Eclipse integration plugin, and then everything compiles and links fine with the system supplied gcc and system installed boost libraries.

    But on Windows, I'm getting into issues. There I also downloaded Eclipse CDT, the Qt-Eclipse integration pluign, Qt itself, which in turn downloads a specific version of MinGW it likes. I can import and compile the source code samples that come with Qt with this setup.

    But I'm having trouble integration boost into the mix. I tried several approaches.

    Trying to link boost that was compiled for Visual C++

    First I downloaded the binary boost package compiled for Windows from Boost Consulting. It installs fine, and if I add the appropriate directory the include files are found. But, I can't link to any of the boost libraries provided, even if I supply the library path and the name of the library appropriately in the project file as:

    LIBS+= -Lc:\usr\boost\boost_1_35_0\lib -lboost_date_time-vc90-mt-1_35

    seemingly the symbols that are supposed to be in the library are not found by the MinGW linker:

    Qt Code:
    1. g++ -enable-stdcall-fixup -Wl,-enable-auto-import
    2. -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl
    3. -Wl,-subsystem,windows -o release\hello_boost_opengl.exe
    4. release/BoostTime.o release/GlWidget.o release/main.o release/MainWindow.o
    5. release/moc_GlWidget.o release/moc_Mainwindow.o -L"c:\usr\Qt\4.3.5\lib"
    6. -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmain
    7. -lboost_date_time-vc80-mt-1_35 -Lc:\usr\boost\boost_1_35_0\lib -lQtOpenGL4
    8. -lQtGui4 -lQtCore4
    9. release/BoostTime.o(.text$_ZN5boost9gregorian21to_simple_string_typeIcEESbIT_St11char_traitsIS2_ESaIS2_EERKNS0_4dateE[std::basic_string<char,
    10. std::char_traits<char>, std::allocator<char> >
    11. boost::gregorian::to_simple_string_type<char>(boost::gregorian::date
    12. const&)]+0x1b3):BoostTime.cpp: undefined reference to
    13. `boost::gregorian::greg_month::as_short_string() const'
    14. collect2: ld returned 1 exit status
    To copy to clipboard, switch view to plain text mode 

    Trying to use MinGW from nuwen.net

    As an alternative approach, I tried using the MinGW distribution from nuwen.net, which conveniently contains boost as it is. But it seems that one can't really link Qt against this MinGW distribution, as I get:

    Qt Code:
    1. g++ -enable-stdcall-fixup -Wl,-enable-auto-import
    2. -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl
    3. -Wl,-subsystem,windows -o release\hello_boost_opengl.exe
    4. release/BoostTime.o release/GlWidget.o release/main.o release/MainWindow.o
    5. release/moc_GlWidget.o release/moc_Mainwindow.o -L"c:\usr\Qt\4.3.5\lib"
    6. -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmain
    7. -lboost_date_time-vc80-mt-1_35 -Lc:\usr\boost\boost_1_35_0\lib -lQtOpenGL4
    8. -lQtGui4 -lQtCore4
    9. release/BoostTime.o:BoostTime.cpp:(.text$_ZN5boost9date_time14date_formatterINS_9gregorian4dateENS0_13simple_formatIcEEcE14date_to_stringES3_[boost::date_time::date_formatter<boost::gregorian::date,
    10. boost::date_time::simple_format<char>,
    11. char>::date_to_string(boost::gregorian::date)]+0x1f0): undefined reference
    12. to `boost::gregorian::greg_month::as_short_string() const'
    13. c:\usr\Qt\4.3.5\lib/libqtmain.a(qtmain_win.o):qtmain_win.cpp:(.text+0x26):
    14. undefined reference to `___gxx_personality_sj0'
    15. c:\usr\Qt\4.3.5\lib/libqtmain.a(qtmain_win.o):qtmain_win.cpp:(.text+0x39):
    16. undefined reference to `__Unwind_SjLj_Register'
    17. c:\usr\Qt\4.3.5\lib/libqtmain.a(qtmain_win.o):qtmain_win.cpp:(.text+0x255):
    18. undefined reference to `__Unwind_SjLj_Unregister'
    19. c:\usr\Qt\4.3.5\lib/libqtmain.a(qtmain_win.o):qtmain_win.cpp:(.text+0x32c):
    20. undefined reference to `__Unwind_SjLj_Resume'
    21. collect2: ld returned 1 exit status
    To copy to clipboard, switch view to plain text mode 


    maybe the next approach would be to use the MinGW version that is downloaded by Qt, get MSYS, and compile it manually. I wonder if there's a binary downloadable version of boost that can be used out of the box with Qt and MinGW

    All help is appreciated
    Last edited by akos.maroy; 12th June 2008 at 11:53.

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt + boost + MinGW on Windows

    1. You can't mix msvc and mingw c++ libs - so your first approach doesn't work
    2. You can't also mix gcc3 and gcc4 which looks like your second problem

    So oyu have to compile boost by your own - but why do you want to use msys for this? bjam works on cmd.exe fine too.

  3. #3
    Join Date
    Jun 2008
    Posts
    49
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt + boost + MinGW on Windows

    Quote Originally Posted by ChristianEhrlicher View Post
    1. You can't mix msvc and mingw c++ libs - so your first approach doesn't work
    I wasn't sure about this, so thanks for the clarification

    Quote Originally Posted by ChristianEhrlicher View Post
    2. You can't also mix gcc3 and gcc4 which looks like your second problem
    ah, you mean that Qt itself was compiled againts gcc3, and now I'm trying to use gcc4, and therefore it doesn't work... but then again, I could try compiling Qt with gcc4. hm...

    Quote Originally Posted by ChristianEhrlicher View Post
    So oyu have to compile boost by your own - but why do you want to use msys for this? bjam works on cmd.exe fine too.
    I used an msys prompt because I'm more familiar with UNIX prompts

    but, actually trying to run bjam from a Windows Command Prompt give me errors (trying with MinGW that is downloaded and installed by Qt itself)

    Qt Code:
    1. C:\var\install\boost\boost_1_35_0>..\boost-jam-3.1.16-1-ntx86\boost-jam-3.1.16-1
    2. -ntx86\bjam.exe --toolset=gcc --layout=system --with-thread stage
    3. ...patience...
    4. ...found 680 targets...
    5. ...updating 17 targets...
    6. MkDir1 stage
    7. MkDir1 stage\lib
    8. MkDir1 bin.v2
    9. MkDir1 bin.v2\libs
    10. MkDir1 bin.v2\libs\thread
    11. MkDir1 bin.v2\libs\thread\build
    12. MkDir1 bin.v2\libs\thread\build\gcc-3.4.4
    13. MkDir1 bin.v2\libs\thread\build\gcc-3.4.4\release
    14. MkDir1 bin.v2\libs\thread\build\gcc-3.4.4\release\threading-multi
    15. gcc.compile.c++ bin.v2\libs\thread\build\gcc-3.4.4\release\threading-multi\threa
    16. d.o
    17. libs\thread\src\win32\thread.cpp: In function `void boost::<unnamed>::run_thread
    18. _exit_callbacks()':
    19. libs\thread\src\win32\thread.cpp:147: error: `heap_delete' is not a member of `b
    20. oost::detail'
    21. libs\thread\src\win32\thread.cpp:149: error: `heap_delete' is not a member of `b
    22. oost::detail'
    23. libs\thread\src\win32\thread.cpp:159: error: `heap_delete' is not a member of `b
    24. oost::detail'
    25. libs\thread\src\win32\thread.cpp: At global scope:
    26. libs\thread\src\win32\thread.cpp:171: error: no `unsigned int boost::thread::thr
    27. ead_start_function(void*)' member function declared in class `boost::thread'
    28. libs\thread\src\win32\thread.cpp: In member function `void boost::thread::start_
    29. thread()':
    30. libs\thread\src\win32\thread.cpp:194: error: `thread_start_function' undeclared
    31. (first use this function)
    32. libs\thread\src\win32\thread.cpp:194: error: (Each undeclared identifier is repo
    33. rted only once for each function it appears in.)
    34. libs\thread\src\win32\thread.cpp:194: error: 'struct boost::detail::thread_data_
    35. base' has no member named 'id'
    36. libs\thread\src\win32\thread.cpp:194: error: `_beginthreadex' undeclared (first
    37. use this function)
    38. libs\thread\src\win32\thread.cpp:199: error: `intrusive_ptr_add_ref' undeclared
    39. (first use this function)
    40. libs\thread\src\win32\thread.cpp:200: error: `boost::detail::win32' has not been
    41. declared
    42. libs\thread\src\win32\thread.cpp:200: error: `handle' undeclared (first use this
    43. function)
    44. libs\thread\src\win32\thread.cpp: In constructor `boost::<unnamed>::externally_l
    45. aunched_thread::externally_launched_thread()':
    46. libs\thread\src\win32\thread.cpp:215: error: `count' undeclared (first use this
    47. function)
    48. libs\thread\src\win32\thread.cpp:216: error: `interruption_enabled' undeclared (
    49. first use this function)
    50. libs\thread\src\win32\thread.cpp: In function `void boost::<unnamed>::make_exter
    51. nal_thread_data()':
    52.  
    53. ...
    To copy to clipboard, switch view to plain text mode 

    (there are more errors, but the forum has a post limit of 10000 characters, so I truncated the output.)

  4. #4
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt + boost + MinGW on Windows

    The last time I tried the bjam monster (and was then happy that I only use cmake by myself) it worked fine. But it was some time ago...
    And yes - you can't link qt4/gcc3 against app/gcc4 and vice versa as the ABI changed there too afaik.

Similar Threads

  1. using libcurl in QT with Mingw in Windows
    By ct in forum Qt Programming
    Replies: 18
    Last Post: 23rd January 2012, 01:41
  2. A Guide to Install MinGW, Qt4 and Eclipse Integration on Windows XP
    By shiyutang in forum Installation and Deployment
    Replies: 10
    Last Post: 5th August 2009, 04:03
  3. Mingw very slow on windows
    By elsheikhmh in forum Installation and Deployment
    Replies: 7
    Last Post: 30th May 2007, 17:19
  4. How do I use MinGW Compiler in Windows
    By Walsi in forum General Discussion
    Replies: 3
    Last Post: 11th May 2007, 08:50
  5. qt and mingw can not run on windows 98?
    By evewei in forum Installation and Deployment
    Replies: 4
    Last Post: 26th June 2006, 09:22

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.