samedi 27 mars 2021

c++ fatal error no input files, compilation terminated c++11 not found

I'm trying to build simple shared library for gazebo tutorials. In their website, CMakeLists file should be like this

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
find_package(gazebo REQUIRED)
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
list(APPEND CMAKE_CXX_FLAGS "${GAZEBO_CXX_FLAGS}")
add_library(hello_world SHARED hello_world.cc)
target_link_libraries(hello_world ${GAZEBO_LIBRARIES})

And They clearly mention the following

New in gazebo6: c++11 flags are now required for all downstream software to compile against gazebo. This is done with the following line: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

Adding the preceding line in the above CMakeLists yields this error:

c++: fatal error: no input files
compilation terminated. 
/bin/sh: 1: -std=c++11: not found

Removing the line, the compilation proceeds without problem. Any suggestions? My machine:

Ubuntu 20.04.2 LTS, 
cmake version 3.16.3, 
g++ 9.3

Aucun commentaire:

Enregistrer un commentaire