|
Boost : |
Subject: Re: [boost] static in_class constants
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2010-03-13 13:32:04
Christian Henning wrote:
>> ====== BEGIN OUTPUT ======
>> Running 9 test cases...
>> unknown location(0): fatal error in "read_image_info_using_string":
>> std::exception: file_stream_device: failed to open file
>> unknown location(0): fatal error in "read_image_test": std::exception:
>> file_stream_device: failed to open file
> [snip]
>
> I suspect you know what the error is. ;-)
Sure, that's why I mentioned it's not important for this discussion :-)
>> I had to modify Jamfile.v2 to use
>>
>> <library>/boost/test//boost_unit_test_framework/<link>static
>>
>> plus in #define BOOST_TEST_MAIN in pnm_test.cpp
>
> You need to add code to have the pnm cases work? Strange. Please
> confirm, since all works just fine on my Windows box.
The BOOST_TEST_MAIN is required and it is only defined in test.cpp
$ cat test.cpp
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
However, I select to build only pnm_test.cpp which does not link
together with object of the test.cpp:
$ bjam --v2 pnm_test
So, I put BOOST_TEST_MAIN on top of pnm_test.cpp
>> It looks OK to me.
>>
>> I double checked and this is what preprocessor generates for me:
>>
>> struct pnm_image_type : property_base< uint32_t >
>> {
>> static const type _mono_asc = 1;
>> static const type _gray_asc = 2;
>> static const type _color_asc = 3;
>> static const type _mono_bin = 4;
>> static const type _gray_bin = 5;
>> static const type _color_bin = 6;
>> };
>>
>
> My gcc is 3.4.5. Do you think that might be a problem? I can always
> use enums instead.
As I mentioned in my previous reply in this thread, it should not be an
issue, because AFAIK GCC, since 3.4.x, does support [1] compilation of
such definitions of constants.
However, I suppose you may be suffering of address-of-constant issue [2]
which I also confirmed in my previous reply.
[1] http://gcc.gnu.org/ml/gcc-help/2005-10/msg00082.html
[2] http://gcc.gnu.org/ml/gcc-help/2005-10/msg00083.html
Best regards,
-- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk