Reputation: 6738
The problem is that the same code that compiles well on Windows, is unable to compile on Ubuntu. Every time I get this error:
cc1: warnings being treated as errors
Now, it's big code base and I don't like fix all the warnings.
Is there a way I can compile successfully in spite of the warnings?
Upvotes: 143
Views: 325720
Reputation: 1442
Remove -Werror from your Make or CMake files, as suggested in this post.
Upvotes: 19
Reputation: 51
If you are compiling the Linux kernel:
For example, if you want to disable the warning that is "unused-but-set-variable" been treated as error. You can add a statement:
KBUILD_CFLAGS += $(call cc-option,-Wno-error=unused-but-set-variable,)
in your Makefile.
Upvotes: 5
Reputation: 51
The -Wall and -Werror compiler options can cause it. Please check if those are used in compiler settings.
Upvotes: 5
Reputation: 6738
Thanks for all the helpful suggestions. I finally made sure that there were no warnings in my code, but again was getting this warning from SQLite 3:
Assuming signed overflow does not occur when assuming that (X - c) <= X is always true
which I fixed by adding the CFLAG -fno-strict-overflow.
Upvotes: 4
Reputation: 117926
You can make all warnings being treated as such using -Wno-error. You can make specific warnings being treated as such by using -Wno-error=<warning name>
where <warning name>
is the name of the warning you don't want treated as an error.
If you want to entirely disable all warnings, use -w (not recommended).
Source: 3.8 Options to Request or Suppress Warnings
Upvotes: 50
Reputation: 183978
Sure, find where -Werror is set and remove that flag. Then warnings will be only warnings.
Upvotes: 111