SyneRBI / SIRF

Main repository for the CCP SynerBI software
http://www.ccpsynerbi.ac.uk
Other
59 stars 29 forks source link

Gadgetron/STIR include order #420

Open rijobro opened 5 years ago

rijobro commented 5 years ago

This relates to PR #419.

For code that requires including headers of both Gadgetron and STIR wrapper code, it seems that the order is important. This seems to be related to boost.

The following (in sirf_resample.cpp) works fine:

#include "sirf/Gadgetron/gadgetron_data_containers.h"
#include "sirf/STIR/stir_data_containers.h"

whereas this does not:

#include "sirf/STIR/stir_data_containers.h"
#include "sirf/Gadgetron/gadgetron_data_containers.h"

The error for the latter is:

In file included from /Users/rich/Documents/Code/SIRF/Source/src/Synergistic/sirf_resample.cpp:33:
In file included from /Users/rich/Documents/Code/SIRF/Source/src/Registration/cReg/include/sirf/Reg/NiftyResample.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:500:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:176:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:643:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:326:5: error: the parameter for this explicitly-defaulted copy constructor is const, but a member or base requires it to be non-const
    pair(pair const&) = default;
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/map:641:16: note: in instantiation of template class 'std::__1::pair<const boost::system::error_category *const, std::__1::auto_ptr<boost::system::detail::std_category> >' requested here
    value_type __cc;
               ^
/usr/local/include/boost/system/detail/std_interoperability.hpp:64:11: note: in instantiation of template class 'std::__1::__value_type<const boost::system::error_category *, std::__1::auto_ptr<boost::system::detail::std_category> >' requested here
    if( i == map_.end() )
          ^
1 error generated.
make[2]: *** [src/Synergistic/CMakeFiles/sirf_resample.dir/sirf_resample.cpp.o] Error 1
make[1]: *** [src/Synergistic/CMakeFiles/sirf_resample.dir/all] Error 2
make: *** [all] Error 2

All compiled on OSX with Boost 1.70.

rijobro commented 5 years ago

From @KrisThielemans:

This is worrying. It probably means that gadgetron vs STIR containers include a different boost file or set a different define (could be due to the annoying std::shared_ptr STIR workaround). Please create an issue with the errors that you observe without this fix.

Diagnosis will likely mean running gcc -E to output the preprocessed files and check.