添加编译参数,例如:
- add_definitions(-DDEBUG)将在gcc命令行添加 DEBUG 宏定义;
- add_definitions(“-Wall -ansi –pedantic –g”)
编译时有时出现报警warning: extra ‘;’ [-Wpedantic]
,很影响看编译信息,可使用下面方法禁止pedantic
1
2
3
4
5
6
7
8
9
10//save compiler switches
//Bad headers with problem goes here
//restore compiler switches
类似的报警还有warning: ISO C++ forbids variable length array ‘angle_compensate_nodes’ [-Wvla]
,把上面的"-Wpedantic"
换成"-Wvla"
即可