簡體   English   中英

從gcc / g ++編譯結果中刪除文件名

[英]Remove File Name from gcc/g++ Compile Result

我想從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標志嗎?

我懷疑有一個選項,但你可以使用標准實用程序獲得相同的結果。 例如cut(1)

 gcc -c myfolder/temp.c 2>&1 | cut -d: -f2-

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM