c++g++cppunit

c++ compiling cppunit files and executing xml report


I have some .cpp and .h files residing in path

~/NetBeansProjects/myApplication

main.cpp
person.cpp
person.h

and I have my cppunit .cpp and .h files residing in path

~/NetBeansProjects/myApplication/tests

TestCase.cpp
TestCase.h
finalresults.cpp

assuming that I am at ~ and I have cd to directory

/NetBeansProjects/myApplication in my terminal

I want to do a g++ along with my cppunit files TO GENERATE A XML REPORT of the results on cppunit test.

I add the XmlOutputter in my finalresults.cpp

        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

My program runs successfully but no xml is being created.

what additional steps do I need to do?


Solution

  • Run:

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