Boost logo

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


Hello,

Problem solved by modifying the original project, moving the entry point to a separate file.

Was there any other solution?

Tamas

--- 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
To: boost-testing_at_[hidden]
Date: Saturday, May 22, 2010, 11:46 AM

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

-----Inline Attachment Follows-----

_______________________________________________
Boost-Testing mailing list
Boost-Testing_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-testing



Boost-testing list run by mbergal at meta-comm.com