Closed robodyne-robotics closed 3 days ago
Hi @robodyne-robotics I think your error is due to G++ 9.4.0 not compiling with support for C++17 as a default. I am targetting Ubuntu 22.04 and onwards with this code in combination with C++17 as Ubuntu 20.04 is reaching its end of life soon. Add the following to the CMake file to enforce it:
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
This should solve your issue.
Yes, thank you, it works like a charm!
I post here the code in case someone needs it to compile on Ubuntu 18.04 and Ubuntu 20.04:
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
project(test_code)
find_package(myactuator_rmd REQUIRED)
add_executable(test
main.cpp
)
target_link_libraries(test PUBLIC myactuator_rmd::myactuator_rmd)
done
You are welcome. I will add it to the read-me!
Hello,
I looked in the closed issues and I found a similar problem, but it was on Raspberry. I'm on Ubuntu 20.04, my g++ version is 9.4.0 and my cmake is 3.16.3. I had to change the cmake version in the main CMakeLists.txt file as:
cmake_minimum_required(VERSION 3.16)
I'm able to compile the library without any errors, but when I try to compile a sample C++ program as the one mentioned in the readme file, I get this error:
I have this problem only on Ubuntu 20.04, since everything works fine on Ubuntu 22.04. Also, On Ubuntu 20.04, I had to modify
.len
to can_dlc
while I had to do nothing on Ubuntu 22.04 since everything worked fine.I think it is a compiler problem, but I cannot upgrade it because I would damage my ROS Noetic installation.
How can I solve it?