boost test 动态库使用问题
boost test库版本:1.40.0
开发工具: vs2008
附加包含目录为:
E:\******\Package\boost_1_40_0
附件依赖项:
E:\******\Package\boost_1_40_0\bin.v2\libs\test\build\msvc-9.0\debug\address-model-32\asynch-exceptions-on\threading-multi\boost_prg_exec_monitor-vc90-mt-gd-1_40.lib
E:\******\Package\boost_1_40_0\bin.v2\libs\test\build\msvc-9.0\debug\address-model-32\asynch-exceptions-on\threading-multi\boost_unit_test_framework-vc90-mt-gd-1_40.lib
(星号为某文件夹, 这里用星号代替,
另外已经将
E:\******\Package\boost_1_40_0\bin.v2\libs\test\build\msvc-9.0\debug\address-model-32\asynch-exceptions-on\threading-multi\
下的对应的两个dll文件拷贝到下面的工程目录下了)
按boost test中文文档eg9,如下:
#include "stdafx.h"
#define BOOST_TEST_DYN_LINK
#include <boost/test/included/unit_test.hpp>
#include <boost/bind.hpp>
using namespace boost::unit_test;
//____________________________________________________________________________//
void free_test_function( int i, int j )
{
BOOST_CHECK_MESSAGE(false, i);
BOOST_CHECK_MESSAGE(false, j);
BOOST_CHECK( true /* test assertion */ );
}
//____________________________________________________________________________//
bool init_function()
{
framework::master_test_suite().
add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 1 ) ) );
framework::master_test_suite().
add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 2 ) ) );
framework::master_test_suite().
add( BOOST_TEST_CASE( boost::bind( &free_test_function, 2, 1 ) ) );
return 0;
}
//____________________________________________________________________________//
int _tmain( int argc, char* argv[] )
{
return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
}
编译结果:
错误 36 error C2491: “boost::itest::exception_safety”: 不允许 dllimport 函数 的定义 e:\qin_vs2008\package\boost_1_40_0\boost\test\impl\exception_safety.ipp 513
错误 42 error C2491: “boost::itest::logged_expectations”: 不允许 dllimport 函数 的定义 e:\qin_vs2008\package\boost_1_40_0\boost\test\impl\logged_expectations.ipp 228
错误 111 error C2491: “boost::unit_test::unit_test_main”: 不允许 dllimport 函数 的定义 e:\qin_vs2008\package\boost_1_40_0\boost\test\impl\unit_test_main.ipp 175
警告 16 warning C4273: “boost::debug::attach_debugger”: dll 链接不一致 e:\qin_vs2008\package\boost_1_40_0\boost\test\impl\debug.ipp 760
警告 18 warning C4273: “boost::debug::break_memory_alloc”: dll 链接不一致 e:\qin_vs2008\package\boost_1_40_0\boost\test\impl\debug.ipp 953
......
......
麻烦各位达人帮忙看看...