Build failed: AP_GPS_NMEA.cpp:error: 'INT32_MAX' was not declared in this scope

Hey there. When I ran the sim_vehicle.sh -w command I got an error, which cause the build to fail.

AP_GPS_NMEA.cpp:error: ‘INT32_MAX’ was not declared in this scope

After researching for a bit, I suspected it had to do with the “#define __STDC_LIMIT_MACROS”. Despite putting the define above the “#include <stdint.h>” call it still had no effect. I finally found an workaround by introducing “-D__STDC_LIMIT_MACROS” in the 14th line of the /ardupilot/mk/board_native.mk file. The line now reads:

DEFINES += -DCONFIG_HAL_BOARD=$(HAL_BOARD) -DCONFIG_HAL_BOARD_SUBTYPE=$(HAL_BOARD_SUBTYPE) -D__STDC_LIMIT_MACROS

Anyone has a better fix, or an idea of what possibly caused it in my case?

@ChaosSeeker
hi , seeker,

could you explain what is the reason of __STEC_LIMIT_MACROS for INT32_MAX