|
Boost Testing : |
Subject: [Boost-testing] boost::unit_test main function problem
From: Tamas Nagy (ngy_tms_at_[hidden])
Date: 2010-05-22 05:46:24
I have a test.cpp file:
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Hello
// nothing
It contains nothing, but the 2 defines.
I have a long Makefile of a large project. I copied the Makefile of the large project to the _unittest dir. I modified the paths in the Makefile to the proper paths.
The large project has a main.cpp, which has a main() function.
If i want to compile with the boost::unit_test, actually the test.cpp, it says:
In file included from ../_unittest/src/test.cpp:31:
../_prog/src/main.cpp: In function âint main(int, char**)â:
../_prog/src/main.cpp:603 error: redefinition of âint main(int, char**)â
/usr/include/boost/test/unit_test.hpp:57: error: âint main(int, char**)â previously defined here
make: *** [../_unittest/src/test.o] Error 1
So the problem is, that there are 2 entry points. Main.cpp cannot be modified to contain only the functions to be tested, because a large project relies on it. So the ideal solution would be let the original project code untouched, create a test binary that tests the functions from the large project.
I'm a beginner the boost::test, can you help me solve this problem?
Tamas