-
Notifications
You must be signed in to change notification settings - Fork 769
Closed
Labels
Description
Linking CXX shared library ../lib/libfreenect2.so
CMakeFiles/freenect2.dir/src/rgb_packet_stream_parser.cpp.o:(.rodata+0x0): multiple definition of `typeinfo name for libfreenect2::PacketProcessor<libfreenect2::RgbPacket>'
CMakeFiles/freenect2.dir/src/packet_pipeline.cpp.o:(.rodata+0x0): first defined here
CMakeFiles/freenect2.dir/src/rgb_packet_stream_parser.cpp.o:(.data.rel.ro+0x0): multiple definition of `typeinfo for libfreenect2::PacketProcessor<libfreenect2::RgbPacket>'
CMakeFiles/freenect2.dir/src/packet_pipeline.cpp.o:(.data.rel.ro+0x0): first defined here
[...]
collect2: error: ld returned 1 exit status
This bug is introduced in #103. Here is a better background for this bug. Basically, these two explicit instantiations
// explicit instantiation and export to make vsc++ happy
template class LIBFREENECT2_API PacketProcessor<DepthPacket>;
// explicit instantiation and export to make vsc++ happy
template class LIBFREENECT2_API PacketProcessor<RgbPacket>;
in headers being included multiple times violates C++ standard 14.7 clause 5:
an explicit instantiation definition shall appear at most once in a program
and GCC on ARM fails because of optimizations assuming the standard.