-
Notifications
You must be signed in to change notification settings - Fork 449
Description
I'm on Linux. Using Arduino-Makefile:
# Current version: 1.5.2
Here is my project directory makefile:
ARDUINO_IDE_INSTALLATION_PATH = /home/sandsnip3r/Downloads/arduino-1.8.1
# --- nano ide 1.6
BOARD_TAG = nano
BOARD_SUB = atmega328
ARDUINO_DIR = ${ARDUINO_IDE_INSTALLATION_PATH}
MONITOR_PORT = /dev/ttyUSB0
include /usr/share/arduino/Arduino.mk
Running the make with verbose output on, here's the order that it's using for header searching:
#include "..." search starts here:
#include <...> search starts here:
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/arduino/avr/cores/arduino
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/arduino/avr/variants/eightanaloginputs
/usr/include
.
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/include
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/include-fixed
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/include
However, i get many errors like this:
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/avr/include/avr/pgmspace.h:1575:36: error: 'uint_farptr_t' has not been declared
At the top of pgmspace.h
it has #include <inttypes.h>
Looking in /home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/avr/include/inttypes.h
, I see typedef uint32_t uint_farptr_t;
The problem is that, due to the include search path ordering, it uses /usr/include/inttypes.h
rather than the avr header file because it was found first.
My solution ended up requiring a few extra lines in my project Makefile:
CFLAGS += -isystem ${ARDUINO_IDE_INSTALLATION_PATH}/hardware/tools/avr/avr/include
CXXFLAGS += -isystem ${ARDUINO_IDE_INSTALLATION_PATH}/hardware/tools/avr/avr/include
This resulted in the following ordering:
#include "..." search starts here:
#include <...> search starts here:
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/arduino/avr/cores/arduino
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/arduino/avr/variants/eightanaloginputs
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/avr/include
/usr/include
.
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/include
/home/sandsnip3r/Downloads/arduino-1.8.1/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/include-fixed