boost test

http://www.ibm.com/developerworks/cn/aix/library/au-ctools1_boost/


http://www.boost.org/doc/libs/1_51_0/libs/test/doc/html/intro.html


1. Why did I get a linker error when compiling my test program?

 

Boost Test Library components provide several usage variants: to create a test program you can link with the one of the precompiled library variants or use single-header variant. For example, to use Unit Test Framework you may either include the <boost/test/unit_test.hpp> and link with libunit_test_framework.lib or you can include <boost/test/included/unit_test.hpp> , in which case you should not need to link with any precompiled component. Note also that you should strictly follow specification on initialization function in other case some compilers may produce linker error like this.

Unresolved external init_unit_test_suite(int, char**).

The reason for this error is that in your implementation you should specify second argument of init_unit_test_suite exactly as in the specification, i.e.: char* [].

 
2. for

add the below in the front of your code

> > #define BOOST_TEST_DYN_LINK
> > and
> > #define BOOST_TEST_MODULE MyTest

codes like: #include <...>


and compile with $g++ -Wall xxx.cpp -lboost_unit_test_framework

refer to test_boost_suit.cpp and sample1.cpp in develop/boost/unit_test/ in ubuntu

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值