なんか発見
色々ネットをあさっていると
https://bugs.launchpad.net/ubuntu/+source/boost/+bug/162155
こんな記事がありました....。
The boost documentation is outdated. Please read
/usr/include/boost/test/unit_test.hpp
which defines "main" (i.e. it is not a real symbol in the lib*.so).
You will find the requirement for two precompiler defines
if defined(BOOST_TEST_DYN_LINK) && defined(BOOST_TEST_MAIN)
.....しるかーーーーーーーーーーーーーー。
ソース嫁っていうのはちょっとひどいwwwww
で、ソースの先頭に
#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN
をつけて再度コンパイル!
[sakura@sakura-no-macbook.local] $ g++ test.cc -lboost_unit_test_framework [~] [sakura@sakura-no-macbook.local] $
コンパイルできたー!
さて実行
[sakura@sakura-no-macbook.local] $ ./a.out Running 3 test cases... zsh: segmentation fault ./a.out
ええええええええええええええええ。
うーんうーん。
もしやとおもってインクルードするファイルを変更してみる
#include <boost/test/unit_test.hpp> // こっちをインクルードするように変更 //#include <boost/test/included/unit_test.hpp> // こっちはインクルードしない
すると
[sakura@sakura-no-macbook.local] $ ./a.out [~] Running 1 test case... *** No errors detected
わーい。実行できたー。