> I'm consistently getting segfaults trying to use boost test on my Mac. The test works fine on Linux.
Even stranger: I only get the segfault if I link against unit_test_framework.
dave
<><
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Monday, 8. November 2010 21:19:33 David M.Lee wrote:
> Here's the test I'm running:
>
> #define BOOST_TEST_MODULE simple
> #include <boost/test/included/unit_test.hpp>
Why do you use the "included" version of Boost.Test anyway?
> Even stranger: I only get the segfault if I link against
> unit_test_framework.
Yes, this is a classical ODR violation. You get one Boost.Test library built
by "included" and a second instance linked in. And all bets are off.
Either use the "included" variant or link against the lib.
The correct #include for linking against the library is
#include <boost/test/unit_test.hpp>
Yours,
Jürgen
--
* Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für
* voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH
* fax : ++49 511 262926 99 ! Lister Straße 15
* juergen...@ivembh.de ! www.ivembh.de
*
* Geschäftsführer: ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke !
On Nov 8, 2010, at 2:19 PM, David M. Lee wrote:I'm consistently getting segfaults trying to use boost test on my Mac. The test works fine on Linux.
Even stranger: I only get the segfault if I link against unit_test_framework.
dave
<><
On Tuesday, 9. November 2010 17:46:35 David M.Lee wrote:
> If I #include <boost/test/unit_test.hpp>, I get a linker error:
>
> g++ -o simple-test simple-test.cpp -lboost_unit_test_framework
> Undefined symbols:
> "_main", referenced from:
> start in crt1.10.6.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
main() is normally defined by BOOST_TEST_MODULE if BOOST_TEST_DYN_LINK is also
defined. Seems the latter is missing on your command line.
#define BOOST_TEST_MODULE simple
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE(testSimple)
{
BOOST_CHECK_EQUAL(true, true);
}
If this does not help, please provide a complete testcase. (bjam driven
preferred).
Yours,
Jürgen
--
* Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für
* voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH
* fax : ++49 511 262926 99 ! Lister Straße 15
* juergen...@ivembh.de ! www.ivembh.de
*
* Geschäftsführer: ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke !
_______________________________________________