gpt4 book ai didi

gcc - 可以将gcc配置为不在警告/错误消息中打印出完整路径吗?

转载 作者:行者123 更新时间:2023-12-03 17:44:23 24 4
gpt4 key购买 nike

当gcc打印出警告或错误时,它将显示包含错误的文件的完整路径。是否有一个标志可以将输出缩短为仅文件名?

最佳答案

这仅取决于您如何调用gcc:

/tmp/c$ gcc -Wall bad.cbad.c:1: warning: return type defaults to ‘int’bad.c: In function ‘main’:bad.c:1: warning: control reaches end of non-void function

vs

/tmp/c$ gcc -Wall /tmp/c/bad.c/tmp/c/bad.c:1: warning: return type defaults to ‘int’/tmp/c/bad.c: In function ‘main’:/tmp/c/bad.c:1: warning: control reaches end of non-void function

vs

/tmp/c$ gcc -Wall ../../tmp/c/bad.c../../tmp/c/bad.c:1: warning: return type defaults to ‘int’../../tmp/c/bad.c: In function ‘main’:../../tmp/c/bad.c:1: warning: control reaches end of non-void function

where contents of bad.c are just

main() { }

如果有人在乎。

关于gcc - 可以将gcc配置为不在警告/错误消息中打印出完整路径吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1282392/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com