I am trying to install the MMMTools https://mmm.humanoids.kit.edu/installation.html. My cmake version is 3.16.3. I went through every step without any errors until this section
cd ~/MMMCore
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
The make
command returns me the following error.
(base) kong@kong-Standard:~/MMMCore/build$ make
[ 1%] Building CXX object CMakeFiles/MMMCore.dir/MMM/XMLTools.cpp.o
/home/kong/MMMCore/MMM/XMLTools.cpp: In function ‘void MMM::XML::makeAbsolutePath(const string&, std::string&)’:
/home/kong/MMMCore/MMM/XMLTools.cpp:650:64: error: ‘operator/’ is not a member of ‘std::filesystem’; did you mean ‘operator~’?
650 | std::filesystem::path filenameNewComplete = std::filesystem::operator/(filenameBasePath, filenameNew);
| ^~~~~~~~~
| operator~
make[2]: *** [CMakeFiles/MMMCore.dir/build.make:76: CMakeFiles/MMMCore.dir/MMM/XMLTools.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:295: CMakeFiles/MMMCore.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
But I googled the function and saw that it is a member of std::filesystem https://en.cppreference.com/w/cpp/filesystem/path/operator_slash. What went wrong?
I had a look through the CMakeLists.txt and saw this.
###########################################################
#### Compiler configuration ####
###########################################################
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # enable -fPIC
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /MP")
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# cmake 3.10 does not understand c++2a, so we tell it we will handle the standard flag
set(CMAKE_CXX_STANDARD_DEFAULT)
add_definitions(-std=c++2a)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
endif()
add_compile_options(-Werror)
I am compiling it on Ubuntu 20.04 so I guess it enters the elseif section. Does it mean that it is not using C++17? Do I need to edit the line set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
to have it use C++17?
The guide indicates that it is for 18.04 but since the issue is with C++17 I don't think the fault lies in using 20.04?