CppUnit在VS2010上的正确使用

CPPUnit is a unit testing framework that is a port of the popular JUnitframework. Work on it has stalled and there has been no release since 2008. Work has continued on a fork called CPPUnit2.

The last released version of CPPUnit is 1.21.1. I needed it for a project, but compiling it with Visual C++ 2010 ended in lots of errors. I got it compiling after making some changes. This version can be downloaded from here.

The changes are:

  • The DSPlugIn project was removed.
  • The version was changed to 10.0 in the MSDevCallerListCtrl.cpp.//#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("10.0") lcid("0") raw_interfaces_only named_guids
  • Changes made to the naming of .exe, .lib and .dll files produced by the projects in the CPPUnit solution.

http://www.cnblogs.com/kill-signal/archive/2012/12/02/2798483.html

如何编译:

0 : 编译环境 windows7, vs2010

1 :下载源码包 最新的版本是1.21.1(2008年最后一次更新)

地址 :http://sourceforge.net/projects/cppunit/ 或者直接点击 http://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/cppunit-1.12.1.tar.gz/download

2 : 复制cppunt-1.12.1到c:\解压得到目录C:\cppunit-1.12.1

3 : 进入C:\cppunit-1.12.1\src 用VS2010打开CppUnitLibraries.dsw提示转换,转换之

4 : 在项目列表看见一堆项目,默认是以Debug的方式编译,如以该方式编译需要修改目标文件名

cppunit                $(ProjectName)   ->   $(ProjectName)d
cppunit_dll           $(ProjectName)   ->   cppunitd_dll
DllPlugInTester     $(ProjectName)   ->   $(ProjectName)d_dll
TestPlugInRunner $(ProjectName)   ->   $(ProjectName)d
TestRunner          $(ProjectName)  ->   $(ProjectName)d

需要修改目标文件名的原因是上述项目都设置了生成事件,在生成以后都会把生成的文件复制到lib目录下,个人判断d应该是代表了测试版的意思,如果是Release版本生成的目标文件都是项目名不需要修改

5 : 修改DSPlugIn入口
属性,配置属性,链接器,高级,无入口点 设置是

6 : 修改无法加载类型库(编译TestPlugInRunner,TestRunner)会报错其中7.0修改为8.0
#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("7.0") lcid("0") raw_interfaces_only named_guids

以上设置都全做完以后就可以整体编译解决方案了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值