Boost Testing :
Subject: Re: [Boost-testing] boost::unit_test main function problem
From: Tamas Nagy (ngy_tms_at_[hidden])
Date: 2010-05-22 08:16:24
Problem solved by modifying the original project, moving the entry point to a separate file.
Was there any other solution?
--- On Sat, 5/22/10, Tamas Nagy <ngy_tms_at_[hidden]> wrote:
From: Tamas Nagy <ngy_tms_at_[hidden]>
Subject: [Boost-testing] boost::unit_test main function problem
Date: Saturday, May 22, 2010, 11:46 AM
I have a test.cpp file:
#define BOOST_TEST_MODULE Hello
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?
-----Inline Attachment Follows-----
Boost-Testing mailing list