Frage

I have a very simple Boost unit test as below:

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE myModule
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE(universeInOrder)
{
    BOOST_CHECK(true);
}

This compiles just fine without any problems. However, when I run the application, there is no output to the console view and the console view shows that the application is terminated. I tried setting the log level as a program argument via --log_level=all, but to no effect. However, when I run my executable from the command line, I see the expected output. I also cannot debug the program, which is a very critical problem. I'm using Eclipse 3.7, MinGW 4.6, and Boost 1.52. Any thoughts?

Edit Here are my compiler args:

g++ -IC:\Boost\boost_1_52_0 -O0 -g3 -Wall -c -fmessage-length=0 -o src\Test1.o ..\src\Test1.cpp

g++ -LC:\Boost\boost_1_52_0\stage\lib -o MinGWUnitTestProject.exe src\Test1.o -llibboost_unit_test_framework-mgw46-d-1_52

War es hilfreich?

Lösung

The problem was that when executing the test in Eclipse, the Boost unit test library was not on the execution path. I fixed this by modifying my 'Run Configuration' to add the directory of the Boost unit test library to the 'Path' environment variable. It now runs and gives me output as well as allowing me to debug.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top