我想从gcc / g ++编译错误消息中删除文件名。
当我运行gcc myfolder/temp.c
时,结果为:
myfolder/temp.c:5:1: error: unknown type name ‘voi’
myfolder/temp.c:87:6: error: conflicting types for ‘max’
myfolder/temp.c:5:5: note: previous declaration of ‘max’ was here
但我想要这个:
5:1: error: unknown type name ‘voi’
87:6: error: conflicting types for ‘max’
5:5: note: previous declaration of ‘max’ was here
那是否有gcc标志?
答案 0 :(得分:3)
我怀疑有一个选项,但您可以使用标准实用程序获得相同的结果。例如cut(1)
gcc -c myfolder/temp.c 2>&1 | cut -d: -f2-