简体   繁体   中英

gcc C++ Linker make “type of 'X' does not match original declaration” an error?

How do I make the following linker warning about a wrong extern declaration an error? I am compiling & linking with gcc version 4.8.3 Sourcery CodeBench

uilding target: xxxxx.elf Invoking: Cross ARM C++ Linker arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -ffunction-sections -fdata-sections -flto -g3 -T "..\\config\\stm32f4ems\\STM32F407xG_CCM.ld" -Xlinker --gc-sections -Wl,-Map,"rusefi.map" -Wl,-Map,"rusefi.map" -mcpu=cortex-m4 -mthumb -g3 ....

xxx.cpp:584:21: warning: type of 'afrMap' does not match original declaration [enabled by default]

extern fuel_Map3D_t afrMap;

I would like this to not succeed so that I do not miss the issue again.

Try to use the flag -Werror

From this link :

-Werror
Make all warnings into errors.

EDIT: If you want to be more specific, you can use

-Werror=
Make the specified warning into an error. 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM