私はboost.test
をブースト1.33.1のリモートシステムで使用しようとしています。私のPC上でhttp://www.boost.org/doc/libs/1_42_0/libs/test/doc/html/tutorials/hello-the-testing-world.html作品から、この小さな例:古いバージョンのboost.testでの問題
#define BOOST_TEST_MODULE MyTest
#include <boost/test/included/unit_test.hpp> // I've changed here
int add(int i, int j) { return i+j; }
BOOST_AUTO_TEST_CASE(my_test) // <--- line 7
{
// seven ways to detect and report the same error:
BOOST_CHECK(add(2,2) == 4); // #1 continues on error
BOOST_REQUIRE(add(2,2) == 4); // #2 throws on error
if(add(2,2) != 4)
BOOST_ERROR("Ouch..."); // #3 continues on error
if(add(2,2) != 4)
BOOST_FAIL("Ouch..."); // #4 throws on error
if(add(2,2) != 4) throw "Ouch..."; // #5 throws on error
BOOST_CHECK_MESSAGE(add(2,2) == 4, // #6 continues on error
"add(..) result: " << add(2,2));
BOOST_CHECK_EQUAL(add(2,2), 4); // #7 continues on error
}
が、ファイルunit_test.hpp
が存在しないリモートシステム上。私のPC上のファイルunit_test_framework.hpp
は、単純に:
// deprecated
#include <boost/test/included/unit_test.hpp>
であり、メインシステムに存在します。だから私はに含める変更しようとしました:
#include <boost/test/included/unit_test_framework.hpp>
コンパイラは言う:
main.cpp:7: error: expected constructor, destructor, or type conversion before ‘(’ token
これを何ですか?どのようにそれを解決するには?
どのシステムで含める? –
リモートシステムにどのバージョンのブーストがインストールされているか教えてください。 – jopasserat
remote:1.33.1、local:1.36.0 –