Rom*_*nko 6 gcc compiler-errors g++
我正在使用-pedanticflag 构建我的程序,这会导致extra ';'错误(因为第三方标头使用了一些不一致的宏;当-pedantic关闭时不会显示错误).我真的不想-pedantic关闭,我也不想编辑标题.有没有办法抑制这个确切的错误?像-Wno-annoying-semicolon-error编译器开关或什么?
您可以像这样抑制外部标题的迂腐警告:
//save compiler switches
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
//Bad headers with problem goes here
#include <ros/ros.h>
#include <sensor_msgs/LaserScan.h>
//restore compiler switches
#pragma GCC diagnostic pop
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3126 次 |
| 最近记录: |