Opened 8 years ago

Closed 8 years ago

#10654 closed Bugs (worksforme)

Compiling/linking in MS Visual Studio Express 2013

Reported by: James Henry <tigerstripe40@…> Owned by:
Milestone: To Be Determined Component: Building Boost
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

Trying to run boost testing for Exercism Bob C++ exercise. I cannot run the test.

Getting: Error 1 error LNK2005: "bool cdecl init_unit_test(void)" (?init_unit_test@@YA_NXZ) already defined in bob.obj C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 2 error LNK2005: _main already defined in bob.obj C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 3 error LNK1104: cannot open file 'boost_unit_test_framework-vc120-mt-gd-1_56.lib' C:\Users\bubba\exercism\cpp\bob\Bob\LINK Bob

Error 3 indicates cannot open file: 'boost_unit_test_framework-vc120-mt-gd-1_56.lib' However, I have 'libboost_unit_test_framework-vc120-mt-gd-1_56.lib' in the path.

renaming the file results in the following errors:

Error 1 error LNK2005: "bool cdecl init_unit_test(void)" (?init_unit_test@@YA_NXZ) already defined in bob.obj C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 2 error LNK2005: _main already defined in bob.obj C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 3 error LNK2019: unresolved external symbol "declspec(dllimport) public: static class boost::unit_test::unit_test_log_t & cdecl boost::unit_test::singleton<class boost::unit_test::unit_test_log_t>::instance(void)" (imp_?instance@?$singleton@Vunit_test_log_t@unit_test@boost@@@unit_test@boost@@SAAAVunit_test_log_t@23@XZ) referenced in function "void cdecl boost::unit_test::anonymous namespace'::dynamic initializer for 'unit_test_log(void)" (??Eunit_test_log@?A0xd6c0e76d@unit_test@boost@@YAXXZ) C:\Users\bubba\exercism\cpp\bob\Bob\bob.obj Bob Error 4 error LNK2001: unresolved external symbol "declspec(dllimport) public: static class boost::unit_test::unit_test_log_t & cdecl boost::unit_test::singleton<class boost::unit_test::unit_test_log_t>::instance(void)" (imp_?instance@?$singleton@Vunit_test_log_t@unit_test@boost@@@unit_test@boost@@SAAAVunit_test_log_t@23@XZ) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 5 error LNK2019: unresolved external symbol "declspec(dllimport) int cdecl boost::unit_test::unit_test_main(bool (cdecl*)(void),int,char * * const)" (imp_?unit_test_main@unit_test@boost@@YAHP6A_NXZHQAPAD@Z) referenced in function _main C:\Users\bubba\exercism\cpp\bob\Bob\bob.obj Bob Error 6 error LNK2001: unresolved external symbol "declspec(dllimport) int cdecl boost::unit_test::unit_test_main(bool (cdecl*)(void),int,char * * const)" (imp_?unit_test_main@unit_test@boost@@YAHP6A_NXZHQAPAD@Z) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 7 error LNK2019: unresolved external symbol "declspec(dllimport) public: thiscall boost::test_tools::predicate_result::predicate_result(bool)" (imp_??0predicate_result@test_tools@boost@@QAE@_N@Z) referenced in function "class boost::test_tools::predicate_result cdecl boost::test_tools::tt_detail::equal_impl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,char const *>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const * const &)" (??$equal_impl@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD@tt_detail@test_tools@boost@@YA?AVpredicate_result@12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABQBD@Z) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 8 error LNK2019: unresolved external symbol "declspec(dllimport) public: thiscall boost::test_tools::predicate_result::~predicate_result(void)" (imp_??1predicate_result@test_tools@boost@@QAE@XZ) referenced in function "bool cdecl boost::test_tools::tt_detail::check_frwd<struct boost::test_tools::tt_detail::equal_impl_frwd,char const [10],class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(struct boost::test_tools::tt_detail::equal_impl_frwd,class boost::unit_test::lazy_ostream const &,class boost::unit_test::basic_cstring<char const >,unsigned int,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,char const (&)[10],char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" (??$check_frwd@Uequal_impl_frwd@tt_detail@test_tools@boost@@$$BY09$$CBDV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@tt_detail@test_tools@boost@@YA_NUequal_impl_frwd@012@ABVlazy_ostream@unit_test@2@V?$basic_cstring@$$CBD@52@IW4tool_level@012@W4check_type@012@AAY09$$CBDPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6@Z) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 9 error LNK2019: unresolved external symbol "declspec(dllimport) public: void thiscall boost::unit_test::unit_test_log_t::set_checkpoint(class boost::unit_test::basic_cstring<char const >,unsigned int,class boost::unit_test::basic_cstring<char const >)" (imp_?set_checkpoint@unit_test_log_t@unit_test@boost@@QAEXV?$basic_cstring@$$CBD@23@I0@Z) referenced in function "public: void thiscall stating_something::test_method(void)" (?test_method@stating_something@@QAEXXZ) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 10 error LNK2019: unresolved external symbol "declspec(dllimport) bool cdecl boost::test_tools::tt_detail::check_impl(class boost::test_tools::predicate_result const &,class boost::unit_test::lazy_ostream const &,class boost::unit_test::basic_cstring<char const >,unsigned int,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,unsigned int,...)" (imp_?check_impl@tt_detail@test_tools@boost@@YA_NABVpredicate_result@23@ABVlazy_ostream@unit_test@3@V?$basic_cstring@$$CBD@63@IW4tool_level@123@W4check_type@123@IZZ) referenced in function "bool cdecl boost::test_tools::tt_detail::check_frwd<struct boost::test_tools::tt_detail::equal_impl_frwd,char const [10],class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(struct boost::test_tools::tt_detail::equal_impl_frwd,class boost::unit_test::lazy_ostream const &,class boost::unit_test::basic_cstring<char const >,unsigned int,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,char const (&)[10],char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" (??$check_frwd@Uequal_impl_frwd@tt_detail@test_tools@boost@@$$BY09$$CBDV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@tt_detail@test_tools@boost@@YA_NUequal_impl_frwd@012@ABVlazy_ostream@unit_test@2@V?$basic_cstring@$$CBD@52@IW4tool_level@012@W4check_type@012@AAY09$$CBDPBDABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6@Z) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 11 error LNK2019: unresolved external symbol "declspec(dllimport) public: thiscall boost::unit_test::test_case::test_case(class boost::unit_test::basic_cstring<char const >,class boost::unit_test::callback0<struct boost::unit_test::ut_detail::unused> const &)" (imp_??0test_case@unit_test@boost@@QAE@V?$basic_cstring@$$CBD@12@ABV?$callback0@Uunused@ut_detail@unit_test@boost@@@12@@Z) referenced in function "class boost::unit_test::test_case * cdecl boost::unit_test::make_test_case(class boost::unit_test::callback0<struct boost::unit_test::ut_detail::unused> const &,class boost::unit_test::basic_cstring<char const >)" (?make_test_case@unit_test@boost@@YAPAVtest_case@12@ABV?$callback0@Uunused@ut_detail@unit_test@boost@@@12@V?$basic_cstring@$$CBD@12@@Z) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 12 error LNK2019: unresolved external symbol "declspec(dllimport) class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > cdecl boost::unit_test::ut_detail::normalize_test_case_name(class boost::unit_test::basic_cstring<char const >)" (imp_?normalize_test_case_name@ut_detail@unit_test@boost@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$basic_cstring@$$CBD@23@@Z) referenced in function "class boost::unit_test::test_case * cdecl boost::unit_test::make_test_case(class boost::unit_test::callback0<struct boost::unit_test::ut_detail::unused> const &,class boost::unit_test::basic_cstring<char const >)" (?make_test_case@unit_test@boost@@YAPAVtest_case@12@ABV?$callback0@Uunused@ut_detail@unit_test@boost@@@12@V?$basic_cstring@$$CBD@12@@Z) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 13 error LNK2019: unresolved external symbol "declspec(dllimport) public: thiscall boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(class boost::unit_test::test_case *,unsigned long)" (imp_??0auto_test_unit_registrar@ut_detail@unit_test@boost@@QAE@PAVtest_case@23@K@Z) referenced in function "void cdecl `dynamic initializer for 'stating_something_registrar5(void)" (??Estating_something_registrar5@@YAXXZ) C:\Users\bubba\exercism\cpp\bob\Bob\bob_test.obj Bob Error 14 error LNK1120: 9 unresolved externals C:\Users\bubba\exercism\cpp\bob\Bob\Debug\Bob.exe Bob

Change History (1)

comment:1 by John Maddock, 8 years ago

Component: NoneBuilding Boost
Resolution: worksforme
Status: newclosed

You need to link against a compatible library variant - and as you've discovered the library you renamed is not that. Suggest you delete all your libboost_unit_test*.* files then rebuild Boost using the --build-type=complete option. See also http://www.boost.org/doc/libs/1_56_0/more/getting_started/windows.html

Note: See TracTickets for help on using tickets.