pageldev / libOpenDRIVE

Small, lightweight C++ library for handling OpenDRIVE files
Apache License 2.0
368 stars 134 forks source link

Compilation Error on Ubuntu 22.04 (error: ‘plus’ is not a member of ‘std’) #50

Closed heuerfin closed 10 months ago

heuerfin commented 1 year ago

Somehow on my machine (Ubuntu 22.04 LTS) compilation fails with the following errors:

libOpenDRIVE/include/Math.hpp:47:35: error: ‘plus’ is not a member of ‘std’
libOpenDRIVE/include/Math.hpp:53:35: error: ‘minus’ is not a member of ‘std’; did you mean ‘min’?
libOpenDRIVE/include/Math.hpp:80:66: error: ‘multiplies’ is not a member of ‘std’

Even though it should be in the standard of c++14 (https://en.cppreference.com/w/cpp/utility/functional/plus) compilation fails. I've tried to update gcc and c++ from 9.4.0 to 11.3.0 but this did not resolve the issues.

After changing CMAKE_CXX_STANDARD to 17 or above, the issues are resolved (I still need to resolve https://github.com/grepthat/libOpenDRIVE/issues/46 but after that, it works).

So for anyone else with issues like that, change https://github.com/grepthat/libOpenDRIVE/blob/master/CMakeLists.txt#L8 to set(CMAKE_CXX_STANDARD 17).

From my side this issue can immediately be resolved since it isn't an issue regarding this lib. But wanted to share the issue for anyone else having trouble.

pageldev commented 10 months ago

should be fixed, please comment if this is still an issue