Created
May 10, 2012 07:18
-
-
Save tetsuok/2651640 to your computer and use it in GitHub Desktop.
Code to test boost test link error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -x | |
| cat << EOF > foo.cc | |
| #define BOOST_TEST_MODULE foo | |
| #include <boost/test/unit_test.hpp> | |
| BOOST_AUTO_TEST_CASE(foo_test) { | |
| int a = 0; | |
| BOOST_CHECK_EQUAL(0, a); | |
| } | |
| EOF | |
| # dynamic linking works fine | |
| g++ -DBOOST_TEST_DYN_LINK foo.cc -lboost_unit_test_framework-mt && echo "ok" | |
| clang++ -DBOOST_TEST_DYN_LINK foo.cc -lboost_unit_test_framework-mt && echo "ok" | |
| # static linking | |
| g++ foo.cc -lboost_unit_test_framework-mt -static && echo "ok" | |
| clang++ foo.cc -lboost_unit_test_framework-mt -static && echo "ok" | |
| # fail | |
| g++ -DBOOST_TEST_DYN_LINK foo.cc -lboost_unit_test_framework-mt -static | |
| clang++ -DBOOST_TEST_DYN_LINK foo.cc -lboost_unit_test_framework-mt -static |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment