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:
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
以上设置都全做完以后就可以整体编译解决方案了