Praveen's Blog

An Eternal Quest for Incremental Improvement

CppUnit CompilerOutputter error output and Emacs

I am casually evaluating CppUnit lately. It is pretty good. I was using the CompileOutputter as the outputter for CppUnit tests. However, the default settings for gcc is not Emacs friendly for multi-directory projects. To overcome this, I had to set the location format of the CompilerOuputter to "%p:%l:".

CppUnit::CompilerOutputter *outputter = new CppUnit::CompilerOutputter( &runner.result;(), std::cerr );
outputter->setLocationFormat( "%p:%l:" );
runner.setOutputter( outputter  );
bool wasSuccessful =;

I didn't see any other documentation for this apart from the CompilerOutputter.h itself that says the following.

/* The location format is a string in which the occurence of the following character
* sequence are replaced:
* - "%l" => replaced by the line number
* - "%p" => replaced by the full path name of the file ("G:\\prg\\vc\\cppunit\\MyTest.cpp")
* - "%f" => replaced by the base name of the file ("MyTest.cpp")