fzi-forschungszentrum-informatik / Lanelet2

Map handling framework for automated driving
BSD 3-Clause "New" or "Revised" License
800 stars 327 forks source link

Error while building project using structs from Attribute.h of lanelet2_core #49

Closed dan-dan97 closed 5 years ago

dan-dan97 commented 5 years ago

I have a building error with Ubuntu 18 gcc-7. The project is using c++14, the building tool is catkin tools. When I build workspace with my project using any static constexpr constant from any struct of Attribute.h I have undefined reference error on that constant. That can be fixed with

P.S. there is no problem while using gcc-5 on Ubuntu 16

poggenhans commented 5 years ago

I suppose the problem occurs because you are mixing C++14 and C++17 builds.

Lanelet2 by default is built using C++17 if the compiler supports it (gcc5 doesn't). Because in C++17 the symbols that are defined in Attribute.cpp are not necessary, they are not compiled. If your C++14 project tries to use them, you get undefined references.

You could fix that issue by setting CMAKE_CXX_STANDARD=14 in cmake when compiling lanelet2.

dan-dan97 commented 5 years ago

poggenhans thank you. I didn't recognize that c++17 was enabled in mrt when building lanelet2. I fixed the error with enabling c++17 in my project.