Boost C++ Libraries: Ticket #10654: Compiling/linking in MS Visual Studio Express 2013 https://svn.boost.org/trac10/ticket/10654 <p> Trying to run boost testing for Exercism Bob C++ exercise. I cannot run the test. </p> <p> Getting: Error 1 error LNK2005: "bool <span class="underline">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 </span></p> <p> 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. </p> <p> renaming the file results in the following errors: </p> <p> Error 1 error LNK2005: "bool <span class="underline">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 "</span>declspec(dllimport) public: static class boost::unit_test::unit_test_log_t &amp; <span class="underline">cdecl boost::unit_test::singleton&lt;class boost::unit_test::unit_test_log_t&gt;::instance(void)" (</span>imp_?instance@?$singleton@Vunit_test_log_t@unit_test@boost@@@unit_test@boost@@SAAAVunit_test_log_t@23@XZ) referenced in function "void <span class="underline">cdecl boost::unit_test::<code>anonymous namespace'::</code>dynamic initializer for 'unit_test_log<em>(void)" (??</em></span><em>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 "<span class="underline">declspec(dllimport) public: static class boost::unit_test::unit_test_log_t &amp; </span>cdecl boost::unit_test::singleton&lt;class boost::unit_test::unit_test_log_t&gt;::instance(void)" (<span class="underline">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 "</span>declspec(dllimport) int <span class="underline">cdecl boost::unit_test::unit_test_main(bool (</span>cdecl*)(void),int,char * * const)" (<span class="underline">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 "</span>declspec(dllimport) int <span class="underline">cdecl boost::unit_test::unit_test_main(bool (</span>cdecl*)(void),int,char * * const)" (<span class="underline">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 "</span>declspec(dllimport) public: <span class="underline">thiscall boost::test_tools::predicate_result::predicate_result(bool)" (</span>imp_??0predicate_result@test_tools@boost@@QAE@_N@Z) referenced in function "class boost::test_tools::predicate_result <span class="underline">cdecl boost::test_tools::tt_detail::equal_impl&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,char const *&gt;(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,char const * const &amp;)" (??$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 "</span>declspec(dllimport) public: <span class="underline">thiscall boost::test_tools::predicate_result::~predicate_result(void)" (</span>imp_??1predicate_result@test_tools@boost@@QAE@XZ) referenced in function "bool <span class="underline">cdecl boost::test_tools::tt_detail::check_frwd&lt;struct boost::test_tools::tt_detail::equal_impl_frwd,char const <a class="changeset" href="https://svn.boost.org/trac10/changeset/10" title="*** empty log message *** ">[10]</a>,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt;(struct boost::test_tools::tt_detail::equal_impl_frwd,class boost::unit_test::lazy_ostream const &amp;,class boost::unit_test::basic_cstring&lt;char const &gt;,unsigned int,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,char const (&amp;)<a class="changeset" href="https://svn.boost.org/trac10/changeset/10" title="*** empty log message *** ">[10]</a>,char const *,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,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 "</span>declspec(dllimport) public: void <span class="underline">thiscall boost::unit_test::unit_test_log_t::set_checkpoint(class boost::unit_test::basic_cstring&lt;char const &gt;,unsigned int,class boost::unit_test::basic_cstring&lt;char const &gt;)" (</span>imp_?set_checkpoint@unit_test_log_t@unit_test@boost@@QAEXV?$basic_cstring@$$CBD@23@I0@Z) referenced in function "public: void <span class="underline">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 "</span>declspec(dllimport) bool <span class="underline">cdecl boost::test_tools::tt_detail::check_impl(class boost::test_tools::predicate_result const &amp;,class boost::unit_test::lazy_ostream const &amp;,class boost::unit_test::basic_cstring&lt;char const &gt;,unsigned int,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,unsigned int,...)" (</span>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 <span class="underline">cdecl boost::test_tools::tt_detail::check_frwd&lt;struct boost::test_tools::tt_detail::equal_impl_frwd,char const <a class="changeset" href="https://svn.boost.org/trac10/changeset/10" title="*** empty log message *** ">[10]</a>,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt;(struct boost::test_tools::tt_detail::equal_impl_frwd,class boost::unit_test::lazy_ostream const &amp;,class boost::unit_test::basic_cstring&lt;char const &gt;,unsigned int,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,char const (&amp;)<a class="changeset" href="https://svn.boost.org/trac10/changeset/10" title="*** empty log message *** ">[10]</a>,char const *,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,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 "</span>declspec(dllimport) public: <span class="underline">thiscall boost::unit_test::test_case::test_case(class boost::unit_test::basic_cstring&lt;char const &gt;,class boost::unit_test::callback0&lt;struct boost::unit_test::ut_detail::unused&gt; const &amp;)" (</span>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 * <span class="underline">cdecl boost::unit_test::make_test_case(class boost::unit_test::callback0&lt;struct boost::unit_test::ut_detail::unused&gt; const &amp;,class boost::unit_test::basic_cstring&lt;char const &gt;)" (?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 "</span>declspec(dllimport) class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; <span class="underline">cdecl boost::unit_test::ut_detail::normalize_test_case_name(class boost::unit_test::basic_cstring&lt;char const &gt;)" (</span>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 * <span class="underline">cdecl boost::unit_test::make_test_case(class boost::unit_test::callback0&lt;struct boost::unit_test::ut_detail::unused&gt; const &amp;,class boost::unit_test::basic_cstring&lt;char const &gt;)" (?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 "</span>declspec(dllimport) public: <span class="underline">thiscall boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(class boost::unit_test::test_case *,unsigned long)" (</span>imp_??0auto_test_unit_registrar@ut_detail@unit_test@boost@@QAE@PAVtest_case@23@K@Z) referenced in function "void <span class="underline">cdecl `dynamic initializer for 'stating_something_registrar5</span></em><span class="underline">(void)" (??</span>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 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10654 Trac 1.4.3 John Maddock Tue, 14 Oct 2014 08:19:26 GMT status, component changed; resolution set https://svn.boost.org/trac10/ticket/10654#comment:1 https://svn.boost.org/trac10/ticket/10654#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">Building Boost</span> </li> </ul> <p> You need to link against a <em>compatible</em> 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 <a href="http://www.boost.org/doc/libs/1_56_0/more/getting_started/windows.html">http://www.boost.org/doc/libs/1_56_0/more/getting_started/windows.html</a> </p> Ticket