Newbie Issues linking Boost Unit Test Framework
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hey there... I recently downloaded, built, and installed Boost 1.32. I am attempting to use the Boost Unit Test Framework but am running into difficulties figuring out which lib to link to. I am compiling with MS VC++ 7.1. The headers appear to be discovered as they should be, but the linker is failing to find the correct lib. I have tried many of the libs which were created by the build, but these all create more errors (typically to do with redefinitions of std:: functions). At this point I am only trying to compile the example code supplied on the projects web site. some of the libs I tried: libboost_prg_exec_monitor-vc71-mt-1_32.lib libboost_test_exec_monitor-vc71-mt-1_32.lib libboost_unit_test_framework-vc71-mt-1_32.lib some articles I found online advised turning on mutithreading in the compiler properities, enabling run time type identification, and setting exceptions to /EHa I've done all of this but nothing is working, it really just looks like a linker problem. Thanks for any help Dave - ------------------------- linking errors: Linking... main.obj : error LNK2019: unresolved external symbol "bool __cdecl boost::test_tools::tt_detail::test_and_continue_impl(bool,class boost::basic_wrap_stringstream<char> &,class boost::unit_test::basic_cstring<char const >,unsigned int,bool,enum boost::unit_test::log_level)" (?test_and_continue_impl@tt_detail@test_tools@boost@@YA_N_NAAV?$basic_ wrap_stringstream@D@3@V?$basic_cstring@$$CBD@unit_test@3@I0W4log_level @63@@Z) referenced in function "void __cdecl free_test_function(void)" (?free_test_function@@YAXXZ) main.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::unit_test::test_suite::add(class boost::unit_test::test_case *,unsigned long,int)" (?add@test_suite@unit_test@boost@@QAEXPAVtest_case@23@KH@Z) referenced in function "class boost::unit_test::test_suite * __cdecl init_unit_test_suite(int,char * * const)" (?init_unit_test_suite@@YAPAVtest_suite@unit_test@boost@@HQAPAD@Z) main.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::unit_test::test_suite::test_suite(class boost::unit_test::basic_cstring<char const >)" (??0test_suite@unit_test@boost@@QAE@V?$basic_cstring@$$CBD@12@@Z) referenced in function "class boost::unit_test::test_suite * __cdecl init_unit_test_suite(int,char * * const)" (?init_unit_test_suite@@YAPAVtest_suite@unit_test@boost@@HQAPAD@Z) main.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl boost::unit_test::ut_detail::normalize_test_case_name(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?normalize_test_case_name@ut_detail@unit_test@boost@@YAABV?$basic_str ing@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV45@@Z) referenced in function "class boost::unit_test::test_case * __cdecl boost::unit_test::create_test_case(void (__cdecl*)(void),class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?create_test_case@unit_test@boost@@YAPAVtest_case@12@P6AXXZV?$basic_s tring@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) main.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall boost::unit_test::test_case::size(void)const " (?size@test_case@unit_test@boost@@UBEKXZ) main.obj : error LNK2019: unresolved external symbol "protected: __thiscall boost::unit_test::test_case::test_case(class boost::unit_test::basic_cstring<char const >,bool,unsigned long,bool)" (??0test_case@unit_test@boost@@IAE@V?$basic_cstring@$$CBD@12@_NK1@Z) referenced in function "public: __thiscall boost::unit_test::function_test_case::function_test_case(void (__cdecl*)(void),class boost::unit_test::basic_cstring<char const >)" (??0function_test_case@unit_test@boost@@QAE@P6AXXZV?$basic_cstring@$$C BD@12@@Z) libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol __malloc_dbg libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z) LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup Debug/unittests.exe : fatal error LNK1120: 9 unresolved externals Build Time 0:00 Build log was saved at "file://e:\C++Source\unittests\Debug\BuildLog.htm" unittests - 11 error(s), 0 warning(s) - ---------------------- Done ---------------------- Build: 0 succeeded, 1 failed, 0 skipped - ---------------------------------------------------------------------- - ---------- -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com> iQA/AwUBQc8OX06myMoV5dC/EQL6eACeI7zolVzltRg/K4qyEtKtezJCVnkAmgK6 xSo1f992Mg3vXkIyQ/2Nk1z+ =6lrH -----END PGP SIGNATURE-----
"Malloc" <malloc@twcny.rr.com> wrote in message news:cqn2p1$vda$1@sea.gmane.org...
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
hey there...
I recently downloaded, built, and installed Boost 1.32.
I am attempting to use the Boost Unit Test Framework but am running into difficulties figuring out which lib to link to.
I am compiling with MS VC++ 7.1. The headers appear to be discovered as they should be, but the linker is failing to find the correct lib. I have tried many of the libs which were created by the build, but these all create more errors (typically to do with redefinitions of std:: functions). At this point I am only trying to compile the example code supplied on the projects web site.
Which example?
some of the libs I tried:
libboost_prg_exec_monitor-vc71-mt-1_32.lib libboost_test_exec_monitor-vc71-mt-1_32.lib libboost_unit_test_framework-vc71-mt-1_32.lib
You need only one of the above depending on with component you are using.
some articles I found online advised turning on mutithreading in the compiler properities, enabling run time type identification, and setting exceptions to /EHa
This seems like right direction to look.
I've done all of this but nothing is working, it really just looks like a linker problem.
There isn't much I could help here. It's obviosly some kind of flags mismatch between library and test compilation. What I would recommend to do is add MS VC library project into your solution (they are located in build directory). Compile and use library produced by it. And compare fllags.
Thanks for any help Dave
Gennadiy
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 "Gennadiy Rozental" <gennadiy.rozental@thomson.com> wrote in message news:cqno4b$kjj$1@sea.gmane.org...
"Malloc" <malloc@twcny.rr.com> wrote in message news:cqn2p1$vda$1@sea.gmane.org...
Hi there... I switched the lib to: libboost_unit_test_framework-vc71-mt.lib and added BOOST_TEST_NO_AUTO_LINK to the preprocessor configuration and this seems to work. The code now runs through to the end but it reports a memory access violation in one of the *.cpp used to build the lib ?? The memory error shows up even if I change the test case to test "2 == 2" so I am confused as to whether or not the code is actually behaving as expected. The code I was trying to compile is the first test example (unit_test_example1). thanks for the help Dave - --- run results - ------------------------------------------------------ Running 1 test case... e:/c++source/unittests/main.cpp(17): error in "free_test_function": test 2 == 1 failed Exception in "free_test_function": memory access violation E:/downloads/boost/boost_1_32_0/libs/test/build/../src/unit_test_suite .cpp(150): fatal error in "free_test_function": Testing aborted *** 1 failure detected (1 failure expected) in test suite "Unit test example 1" Press any key to continue -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com> iQA/AwUBQc/vRE6myMoV5dC/EQKStQCgzabC7Q7ZbVgU1vzug1sfGf03D/wAoJ9z M8tJaogFuqHXgPhCA8+DnQKW =LExm -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 "Gennadiy Rozental" <gennadiy.rozental@thomson.com> wrote in message news:cqno4b$kjj$1@sea.gmane.org...
"Malloc" <malloc@twcny.rr.com> wrote in message news:cqn2p1$vda$1@sea.gmane.org...
I realized what I was reading after that last post. It appears that the library is functioning fine now. no more coding at 5am... promise :) Thanks for all the help Dave -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com> iQA/AwUBQc/xH06myMoV5dC/EQKh3gCguYa5Mjt2jMwn7tacx9RT4L+GqcMAn2+x mM0oth5POlCjtFwU9VgsjygW =PFV1 -----END PGP SIGNATURE-----
participants (2)
-
Gennadiy Rozental
-
Malloc