c++编译cppunit文件并执行xml报告

标签 c++ g++ cppunit

我有一些 .cpp 和 .h 文件驻留在路径中

~/NetBeansProjects/我的应用程序

main.cpp
person.cpp
person.h

我的 cppunit .cpp 和 .h 文件位于路径中

~/NetBeansProjects/myApplication/tests

TestCase.cpp
TestCase.h
finalresults.cpp

假设我在 ~ 并且我有 cd 到目录

/NetBeansProjects/myApplication in my terminal

我想对我的 cppunit 文件执行 g++ 以生成 cppunit 测试结果的 XML 报告。

我在 finalresults.cpp 中添加了 XmlOutputter

        std::ofstream xmlFileOut("testResults.xml");
    XmlOutputter xmlOut(&collectedresults, xmlFileOut);
    xmlOut.write();

the command to use(as suggested) g++ -o finaltestresults person.cpp main.cpp tests/TestCase.cpp tests/finalresults.cpp -lcppunit

我的程序运行成功但没有创建 xml。

我需要执行哪些额外步骤?

最佳答案

g++ -o finalresults main.cpp person.cpp 测试/TestCase.cpp 测试/finalresults.cpp -lcppunit

关于c++编译cppunit文件并执行xml报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21142914/

相关文章:

c++ - 无法根据opencv RotatedRect教程得到相同的图像结果

c++ - 如何在 C++ 项目中包含具有相似名称的头文件

c++ - 如何从预处理程序#if指令调用constexpr函数?

opengl - 编译opengl红皮书9示例

parallel-processing - 线程清理程序提示意外的内存映射

c++ - 使用现有项目进行 CppUnit 测试

c++ - "this"指针是否启用了 RTTI?

c++ - 在 C++ 中打印 char 字符串时,Linux Ubuntu 中的 g++ 出现段错误,但 Windows 中的 g++/MingW 则不会出现段错误

c++ - 如何使用 cppunit 显示测试方法名称

c++ - CPPUnit 数组断言