Poco - Hello World (一)

一, 下载

官网下载地址

https://pocoproject.org/download/index.html 

二, 编译

需要安装VS

加压后,找到Foundation中的sln文件。根据已经VS版本选择对应的sln文件

VS2013 对应的是 Foundation_vs120.sln

1, 首先打开CppUnit_vs120.sln编译,文件会生成到根目录bin文件夹里。

2,打开 Foundation_vs120.sln,逐个编译每个工程。

打开后,整个解决方案编译。

三 运行

1,更改TestSuite的生成目录到根目录的bin中。

  1) 更改Configuration Properties -> General -> Output Directory 

  2)   更改Linker -> General -> Output File.

2,调试运行初探  

  1) Test Main函数

  使用CppUnitMain宏定义的main函数。

#define CppUnitMain(testCase) \
int main(int ac, char **av) \
{ \
std::vector<std::string> args; \
for (int i = 0; i < ac; ++i) \
args.push_back(std::string(av[i])); \
CppUnit::TestRunner runner; \
runner.addTest(#testCase, testCase::suite()); \ //  此处#testcase,为类名。
return runner.run(args) ? 0 : 1; \
}

2)所有testcase都需要进程Test类。suite 可以包含为一个个Test的组合。

posted @ 2017-02-03 17:53  AnAn2017  阅读(274)  评论(0编辑  收藏  举报