ROS编译报错 #error This file requires compiler and library support for the ISO C++ 2011 standard

一、问题描述

编译ROS程序的时候报错:

 error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

具体终端报错信息

In file included from /usr/include/c++/5/random:35:0,
                 from /home/wang/***/src/***/include/***/positioning_system.hpp:4,
                 from /home/wang/***/src/***/src/sensors/positioning_system.cpp:6:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/c++/5/random:35:0,
                 from /home/wang/***/src/****/include/***/odometry.hpp:4,
                 from /home/wang/***/src/***/src/sensors/odometry.cpp:6:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \

二、解决方法

这个问题一般是编译需要 C++ 11 ,但是没有在编译选项中配置 C++ 11 进行编译导致的。所以执行需要在 CMakLists.txt 中 添加如下编译选项即可:

# Compile as C++11
add_compile_options(-std=c++11)

然后再次编译,基本可以编译通过了~~~~

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值