mardi 23 février 2016

g++ refuses to recognize macro BOOST_TEST even though I can include boost/test/included/unit_test.hpp

I'm trying to use the BOOST.unit_test framework. I copied the dummy example in the introduction of the documentation of the framework at http://ift.tt/1WGgNnd.

#define BOOST_TEST_MODULE Dummy Test
#include <boost/test/included/unit_test.hpp>

BOOST_AUTO_TEST_CASE(first_test)
{
    int i = 1;
    BOOST_TEST(i);
    BOOST_TEST(i == 2);
}

I'm under Fedora Linux 23 and I build with g++ as follows.

g++ -o Dummy -c Dummy.cpp -lboost_unit_test_framework -lboost_thread -lboost_system

However this simple build config fails. The macro BOOST_TEST is not recognized. I literally copied the example from the doc and the compiler successfully includes the header... So I'm scratching my head on why is this symbol undefined ?

Thank you for any help !

PS: As a subquestion, is -lsystem or -lthread needed ?

Aucun commentaire:

Enregistrer un commentaire