Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost documentation simple example fails
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-06-07 16:24:24


AMDG

hmiller_at_[hidden] wrote:
> I know I must be doing something wrong. I am trying to use the very
> simple example at:
> http://www.boost.org/doc/libs/1_43_0/libs/test/doc/html/tutorials/hello-the-testing-world.html
>
>
>
> #include <my_class.hpp>
> #define BOOST_TEST_MODULE MyTest
> #include <boost/test/unit_test.hpp>
>
> BOOST_AUTO_TEST_CASE( my_test )
> {
> my_class test_object( "qwerty" );
>
> BOOST_CHECK( test_object.is_valid() );
> }
>
> I constructed and compiled a very simple class to use, but I get a
> compile error using the simple test above. I am using gcc version
> 4.1.2 on SUSE_linux. The compile error I get is:
>
> test_my_class.cpp:5: error: expected constructor, destructor, or type
> conversion before '(' token
>
> It is as if the compiler does not recognize BOOST_AUTO_TEST_CASE.
> <snip>

If you're using an old version of the test library (I don't remember
exactly when
the cutoff is), you need #include <boost/test/test_tools.hpp>

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net