How to disable warnings when compiling C code?

2020-07-09 10:19发布

I am working on 32-bit Fedora 14 system. I'm compiling my source code using gcc.

Does anybody know how to disable warnings while compiling c code?

标签: c gcc
3条回答
贼婆χ
2楼-- · 2020-07-09 10:43

The best is to find the problem. It will prevent you in future looking for errors, which would not have occured, if you fixed the actual one.

But, if you're sure there is no bug or you have assured the problem is caught by your code, place this somewhere in the file (where 177 the number of your warning is):

#pragma diag_suppress 177 // supress #177-D function  was declared but never referenced
查看更多
Lonely孤独者°
3楼-- · 2020-07-09 10:48

Every body tells use -Wall switch with gcc, but you want to disable it. It is not advised, Use debugger to find it.

Linus Torvalds:

"But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

查看更多
Summer. ? 凉城
4楼-- · 2020-07-09 10:55
登录 后发表回答