How to compile without warnings being treated as errors?

前端 未结 7 2175
迷失自我
迷失自我 2020-12-07 14:27

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          


        
相关标签:
7条回答
  • 2020-12-07 14:53

    Remove -Werror from your Make or CMake files, as suggested in this post

    0 讨论(0)
  • 2020-12-07 14:54

    Solution:

    CFLAGS=-Wno-error ./configure
    
    0 讨论(0)
  • 2020-12-07 14:55

    If you are compiling 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

    0 讨论(0)
  • 2020-12-07 14:56

    -Wall and -Werror compiler options can cause it, please check if those are used in compiler settings.

    0 讨论(0)
  • 2020-12-07 15:04

    Sure, find where -Werror is set and remove that flag. Then warnings will be only warnings.

    0 讨论(0)
  • 2020-12-07 15:04

    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: http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html

    0 讨论(0)
提交回复
热议问题