在avr g ++中禁用函数声明错误

Sud*_*dar 2 c++ compiler-errors makefile arduino avr-gcc

我正在使用这个Makefile来编译我的Arduino草图,其中包含CPP和C的以下标志

CPPFLAGS      += -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \
            -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \
            $(SYS_INCLUDES) $(USER_INCLUDES) -g -Os -w -Wall \
            -ffunction-sections -fdata-sections
CFLAGS        = -std=gnu99
CXXFLAGS      = -fno-exceptions
Run Code Online (Sandbox Code Playgroud)

当我编译一个cpp文件时,如果函数在声明之前被使用,我会收到一个致命的错误.我浏览了avr g ++选项,发现选项-Wimplicit-function-declaration可以启用它.此外,它还通过-Wall选项启用,该选项在make文件中使用.

我想启用-Wall选项(因为它启用了很多其他警告)但只禁用-Wimplicit-function-declaration选项.

我检查了文档,但无法弄清楚如何做到这一点.有人可以告诉我该怎么做吗?

Mat*_*Mat 8

编译C++代码时无法禁用该错误 - 这是致命错误,而不是警告.

您可以(但不应该)为C代码(带-Wno-implicit-function-declaration)使用它,但这对C++不起作用.

cc1plus: warning: command line option "-Wno-implicit-function-declaration" 
                  is valid for C/ObjC but not for C++
Run Code Online (Sandbox Code Playgroud)