I'm consistently getting segfaults trying to use boost test on my Mac. The test works fine on Linux.
This is Mac is running Snow Leopard. I compiled boost using Homebrew (http://mxcl.github.com/homebrew/; seehttps://github.com/mxcl/homebrew/blob/master/Library/Formula/boost.rb for the build formula), but I've also tried building Boost myself with the same results.
Any help figuring this out would be greatly appreciated!
Here's the test I'm running:
#define BOOST_TEST_MODULE simple
#include
On Nov 9, 2010, at 12:03 AM, David M. Lee wrote:
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 <><
If I #include
Hi Dave, On Tuesday, 9. November 2010 17:46:35 David M.Lee wrote:
If I #include
, 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
Hi Davie, 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
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
participants (2)
-
David M. Lee
-
Jürgen Hunold