Tried to create a forward declaration for boost::gil::rgba8_image_t:
namespace boost::gil {
class rgba8_image_t;
}
And got this:
... error: definition of type 'rgba8_image_t' conflicts with type alias of the same name
[build] class rgba8_image_t;
[build] ^
[build] /usr/include/boost/gil/typedefs.hpp:207:1: note: 'rgba8_image_t' declared here
[build] BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, rgba)
[build] ^
[build] /usr/include/boost/gil/typedefs.hpp:112:9: note: expanded from macro 'BOOST_GIL_DEFINE_ALL_TYPEDEFS'
[build] BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL(B, CM, CS, CS##_t, CS##_layout_t) \
[build] ^
[build] /usr/include/boost/gil/typedefs.hpp:72:5: note: expanded from macro 'BOOST_GIL_DEFINE_ALL_TYPEDEFS_INTERNAL'
[build] BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL(B, CM, CS, LAYOUT) \
[build] ^
[build] /usr/include/boost/gil/typedefs.hpp:62:11: note: expanded from macro 'BOOST_GIL_DEFINE_BASE_TYPEDEFS_INTERNAL'
[build] using CS##B##_image_t = image<CS##B##_pixel_t, false, std::allocator<unsigned char>>;
[build] ^
[build] <scratch space>:10:1: note: expanded from here
[build] rgba8_image_t
[build] ^
[build] In file included from ...
How to create new forward declaration for the boost::gil::rgba8_image_t properly?
Caution
Forward declarations of highly generic types doesn't really help. You won't be able to interact with them unless you do include the definitions.
If the goal is to do interface abstraction, consider using your own interface type which hides everything GIL related:
Where in your CPP file you will define it without any further complications:
What Is The Technical Issue?
rgba8_image_tis an alias defined asIt does require the other types, so you might do it that way. Here's is the smallest subset I could quickly isolate:
Even Simpler: Predefined Typedefs Header
GIL comes with a header to create all these forward declarations, for all pixel layouts etc. In fact, it's the header that you can see in the error message:
Now you can already use
rgba8_image_t&in your interfaces as an incomplete type.