Author Topic: Boost::test won't link  (Read 5616 times)

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Boost::test won't link
« on: October 19, 2011, 10:31:35 am »
Hi, I've just tried to use boost library for testing but during linking process I'm getting following error:
undefined reference to `boost::test_tools::tt_detail::check_impl(boost::test_tools::predicate_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned int, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned int, ...)'|
What am I doing wrong?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Boost::test won't link
« Reply #1 on: October 19, 2011, 12:48:06 pm »
You're not linking to some of the boost libs. Check the docs, to see which one:)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Boost::test won't link
« Reply #2 on: October 19, 2011, 05:32:10 pm »
Which docs boost or gcc? And where to start? In fairness I don't think that without help I'm able to do that.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Boost::test won't link
« Reply #3 on: October 19, 2011, 05:37:11 pm »
Boost docs, of course.
There you'll find what libs you need to link for particular boost library.
The you can look at the GCC docs for the exact options you need to pass or check the C::B docs/wiki.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Boost::test won't link
« Reply #4 on: October 19, 2011, 07:33:07 pm »
Ok, thanks, I'll try to do it tomorrow and see what I can do with this.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Boost::test won't link
« Reply #5 on: October 21, 2011, 10:23:14 am »
Ok I did it.
For others, in order to configure boost for gcc:
1. Download boost
2. install it according to instructions from boost site
3. In code::blocks in Settings/global variables add path to your boost library for base and lib fields (this should be located in stage/lib folder)
4. In code::blocks in Project/Build options..., linker settings tab, link libraries - add here those libraries
5. In code::blocks in Project/Build options...Search directories tab in compiler subtab add $(#boost) and in linker subtab add $(#boost.lib).
Done. Uphhh... Spent few days on this but it was worth it. Now I can use this great IDE with gcc compiler which at the moment of this writing is miles ahead of MS. I am not being stopped in my personal development by MS - C++11 here I come!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Boost::test won't link
« Reply #6 on: October 21, 2011, 10:33:12 am »
5. In code::blocks in Project/Build options...Search directories tab in compiler subtab add $(#boost) and in linker subtab add $(#boost.lib).
I think it should be $(#boost.include) to be fully correct
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Boost::test won't link
« Reply #7 on: October 21, 2011, 03:20:53 pm »
Hi, I've put just $(#boost) and it seems to work