Boost logo

Boost Users :

Subject: [Boost-users] unit_test compile error under MSVC10
From: Marc de Kamps (M.deKamps_at_[hidden])
Date: 2011-10-21 07:57:18


Hi,

I'm trying to emulate the following example using Visual Studio 10. In one file
I have:

---------

#ifndef QW
#define QW

#ifdef WIN32
#define BOOST_ALL_DYN_LINK // Force boost to use shared libraries
#endif

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

#endif // include guard
--------------
By itself this compiles and runs, correctly reporting that there is an empty
test tree.

In a second file, Test1.cpp , I have:
-----------------
#include <boost/test/unit_test.hpp>

#ifdef WIN32
#define BOOST_ALL_DYN_LINK // Force boost to use shared libraries
#endif

BOOST_AUTO_TEST_CASE(Test1)
{
        BOOST_REQUIRE(true);
}
--------------------------

Compiling now leads to the error below(I use multithreaded debug ddl for the
project). Is there anything obvious I'm doing wrong?
 Thx, Marc

boost_unit_test_framework-vc100-mt-gd-1_47.lib(boost_unit_test_framework-vc100-mt-gd-1_47.dll)
: error LNK2005: "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)"
(?instance@?$singleton_at_Vunit_test_log_t_at_unit_test_at_boost@@@unit_test_at_boost@@SAAAVunit_test_log_t_at_23@XZ)
already defined in Test1.obj
5


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net