Linking with Unit Test Framework on VC7
Hi, I've got the following program to test the unit test suite: --------------------------------- // ICFGTest.cpp : Defines the entry point for the console application. // #include <boost/test/unit_test.hpp> using namespace boost::unit_test_framework; void testPass() { BOOST_CHECK( true ); } test_suite* init_unit_test_suite( int argc, char* argv[] ) { test_suite* test= BOOST_TEST_SUITE( "Test test suite" ); test->add( BOOST_TEST_CASE( &testPass )); return test; } --------------------------------- when I link this with the boost v1.30 unit test framework, I get the following linker errors: Linking... libboost_unit_test_framework.lib(unit_test_suite.obj) : error LNK2005: "public: virtual unsigned long __thiscall boost::unit_test_framework::test_case::size(void)const " (?size@test_case@unit_test_framework@boost@@UBEKXZ) already defined in ICFGTest.obj ICFGTest.obj : error LNK2019: unresolved external symbol "bool __cdecl boost::test_toolbox::detail::test_and_continue_impl(bool,struct boost::test_toolbox::detail::wrapstrstream const &,char const *,int,bool,enum boost::unit_test_framework::report_level)" (?test_and_continue_impl@detail@test_toolbox@boost @@YA_N_NABUwrapstrstream@123@PBDH0W4report_level@u nit_test_framework@3@@Z) referenced in function "void __cdecl testPass(void)" (?testPass@@YAXXZ) ICFGTest.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::unit_test_framework::test_suite::test_suite(char const *)" (??0test_suite@unit_test_framework@boost@@QAE@PBD@Z) referenced in function "class boost::unit_test_framework::test_suite * __cdecl init_unit_test_suite(int,char * * const)" (?init_unit_test_suite@@YAPAVtest_suite@unit_test_ framework@boost@@HQAPAD@Z) Debug/ICFGTest.exe : fatal error LNK1120: 2 unresolved externals ------------------------ The unresolved symbol test_and_continue_impl seems most curious since one of it's parameters expects a wrapstrstream, not a wrap_strstream as the function declaration itself would suggest. Any ideas what I'm doing wrong? (NOTE: I'm linking to the static multi-threaded lib). Thanks! Dan
The unresolved symbol test_and_continue_impl seems most curious since one of it's parameters expects a wrapstrstream, not a wrap_strstream as the function declaration itself would suggest.
Any ideas what I'm doing wrong? (NOTE: I'm linking to the static multi-threaded lib).
Thanks! Dan
Is it possible that you have 2 versions of Boost.Test installed? It looks like you ompile with old one, while link with library built from new sources. Gennadiy.
--- In Boost-Users@yahoogroups.com, "Gennadiy E. Rozental" <rogeeff@m...> wrote:
The unresolved symbol test_and_continue_impl seems most curious since one of it's parameters expects a wrapstrstream, not a wrap_strstream as the function declaration itself would suggest.
Is it possible that you have 2 versions of Boost.Test installed? It looks like you ompile with old one, while link with library built from new sources.
Thanks! I feel the fool... I had forgotten to update my include path to point to boost 1.30 (it was pointing to 1.29). My next question has to do with the dll build of the test library. The build seems to fail on an unresolved external: cpp_main.obj : error LNK2019: unresolved external symbol "int __cdecl cpp_main(int,char * * const)" (?cpp_main@@YAHHQAPAD@Z) referenced in function "public: virtual int __thiscall `anonymous namespace'::cpp_main_caller::function(void)" (?function@cpp_main_caller@?A0xa36c2e5b@@UAEHXZ) ..\..\..\libs\test\build\bin\boost_prg_exec_monito r.dll\msvc\debug\runtime-link-dynamic\threading-mu lti\boost_prg_exec_monitor.dll : fatal error LNK1120: 1 unresolved externals Since the majority of the code I'll be testing links with the multi-threaded dll version of the CRT, I would need this working. Is there something wrong with my setup that prevents the build from working? thanks again! Dan
My next question has to do with the dll build of the test library.
Unfortunately you could not build dll version of Boost.Test components on win32 platform yet. I am working on this issue.
Since the majority of the code I'll be testing links with the multi-threaded dll version of the CRT, I would need this working.
You don't need dll version of Boost.Test libraries even if you use shared C runtime library. For now, you could link with Boost.Test componenyts statically. I am using namely this configuration personally. Gennadiy.
participants (2)
-
d_zakaib
-
Gennadiy E. Rozental