Colcon error with template typename T = real static T WGS84_a()
I am trying to use the WGS84_a from the library GeographicLib. If I compile a ros2 package with this lines of code, then the compiler give the following errors. However, If I add the lines of code below to a simple cpp file then the simple cpp file is successfully compiled. Any ideas on how to solve this problem with the colcon compiler? Thanks in advanced.
GeographicLib::Geocentric earth(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f()); const double lat0 = 58.80996666666667, lon0 = 0.341783333333334; GeographicLib::LocalCartesian proj(lat0, lon0, 0, earth);
error: ‘GeographicLib::Constants::WGS84_a’ is not a type GeographicLib::Geocentric earth(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
Just a quick note: Colcon is not a compiler. Colcon doesn't do anything with your C++ source code.
Colcon starts CMake for you -- with the correct arguments.
The cause of your problem is likely in your
CMakeLists.txt
(ie: you're not setting up the include path correctly).From what you describe, this is not a ROS problem.