fix link errors in enabling boost test #375
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It seems that when enabling boost test with latest boost libs will result in link errors.
My boost is libboost1.58-dev
The errors are described as follows.
[100%] Linking CXX executable ../../bin/sudoku_stat_unittest
CMakeFiles/sudoku_stat_unittest.dir/stat_unittest.cc.o: In function
boost::unit_test::make_test_case(boost::function<void ()> const&, boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long)': /usr/local/include/boost/test/tree/test_unit.hpp:249: undefined reference toboost::unit_test::test_case::test_case(boost::unit_test::basic_cstring, boost::unit_test::basic_cstring, unsigned long, boost::function<void ()> const&)'CMakeFiles/sudoku_stat_unittest.dir/stat_unittest.cc.o: In function
__static_initialization_and_destruction_0(int, int) [clone .constprop.102]': /home/newplan/playground/networking/muduo/examples/sudoku/stat_unittest.cc:16: undefined reference toboost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'/home/newplan/playground/networking/muduo/examples/sudoku/stat_unittest.cc:31: undefined reference to
boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)' /home/newplan/playground/networking/muduo/examples/sudoku/stat_unittest.cc:48: undefined reference toboost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'/home/newplan/playground/networking/muduo/examples/sudoku/stat_unittest.cc:66: undefined reference to
boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)' /home/newplan/playground/networking/muduo/examples/sudoku/stat_unittest.cc:82: undefined reference toboost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'CMakeFiles/sudoku_stat_unittest.dir/stat_unittest.cc.o:/home/newplan/playground/networking/muduo/examples/sudoku/stat_unittest.cc:98: more undefined references to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)' follow
collect2: error: ld returned 1 exit status
examples/sudoku/CMakeFiles/sudoku_stat_unittest.dir/build.make:95: recipe for target 'bin/sudoku_stat_unittest' failed
make[2]: *** [bin/sudoku_stat_unittest] Error 1
CMakeFiles/Makefile2:5188: recipe for target 'examples/sudoku/CMakeFiles/sudoku_stat_unittest.dir/all' failed
make[1]: *** [examples/sudoku/CMakeFiles/sudoku_stat_unittest.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2