Even though I have included header guards on all my header files, when I create a header file PointXYZRGBAI.h and include it in both LidarFile.cpp and core.cpp, an error is generated
duplicate symbol _EIGEN_ALIGN_16 in:
CMakeFiles/core.dir/core.cpp.o
CMakeFiles/core.dir/LidarFile.cpp.o
ld: 1 duplicate symbol for architecture x86_64
and the header the error seems to be complaining about is
#define PCL_NO_PRECOMPILE
#ifndef POINTXYZRGBAI_H
#define POINTXYZRGBAI_H
#endif
#include <pcl/point_types.h>
struct PointXYZRGBAI{
PCL_ADD_POINT4D;
union{
struct{
float intensity;
uint32_t rgba;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN_16;
POINT_CLOUD_REGISTER_POINT_STRUCT(PointXYZRGBAI,
(float, x, x)
(float, y, y)
(float, z, z)
(float, intensity, intensity)
(uint32_t, rgba, rgba)
)
inline std::ostream& operator << (std::ostream& os, const PointXYZRGBAI& p){
os << "(" << p.x << ", " << p.y << ", " << p.z << " - " << p.intensity << " - " << p.rgba << ")";
return (os);
}
and I use EIGEN_ALIGN_16 in my header defined struct for memory alignment. Why is EIGEN_ALIGN_16 a duplicate symbol if a header guard should prevent multiple inclusions? Thank you for the clarification.
endif
should be at the end of the header file as otherwise it is useless. – Ganley