SPI.cpp only under hardware/arduino/avr/libraries ?

I just try to compile an older sketch from arduino 1.0.x with arduino 1.6.5.

I got this error:

..../arduino-1.6.5/libraries/AX12/ax12.h:86:23: error: conflicting declaration 'typedef unsigned char boolean'
 typedef unsigned char boolean;
                       ^
In file included from ..../arduino-1.6.5/hardware/arduino/avr/libraries/SPI/SPI.h:17:0,
                 from AX12Eth_v2.ino:23:
..../arduino-1.6.5/hardware/arduino/avr/cores/arduino/Arduino.h:117:14: error: 'boolean' has a previous declaration as 'typedef bool boolean'
 typedef bool boolean;
              ^
Fehler beim Kompilieren.

So I tried to look into the "new" SPI.h, but found out, that only this one was shipped with arduino-1-6-5:

$ find -name SPI.h
./hardware/arduino/avr/libraries/SPI/src/SPI.h

Now I wonder, if it is correct, that there is only the avr SPI implementation??

(I compile for ATmega 2560)

Thomas33:
Now I wonder, if it is correct, that there is only the avr SPI implementation??
(I compile for ATmega 2560)

Each hardware core will have its own SPI library but you may only have the AVR core installed as any other must be added using Boards Manager. In this case since you're compiling for ATmega2560 which is an AVR only the AVR SPI library is needed.

Thomas33:

..../arduino-1.6.5/libraries/AX12/ax12.h:86:23: error: conflicting declaration 'typedef unsigned char boolean'

typedef unsigned char boolean;
                      ^
In file included from ..../arduino-1.6.5/hardware/arduino/avr/libraries/SPI/SPI.h:17:0,
                from AX12Eth_v2.ino:23:
..../arduino-1.6.5/hardware/arduino/avr/cores/arduino/Arduino.h:117:14: error: 'boolean' has a previous declaration as 'typedef bool boolean'
typedef bool boolean;
             ^
Fehler beim Kompilieren.

The error isn't caused by SPI.h. That's just the file that is including Arduino.h which has the conflicting declaration. You should comment out ..../arduino-1.6.5/libraries/AX12/ax12.h line 86 and you might need to add the line:

#include <Arduino.h>

Thomas33:

..../arduino-1.6.5/libraries/AX12/ax12.h

It looks like you might have installed the AX12 library to your Arduino IDE installation folder. That has nothing to do with your current problem but you're supposed to install libraries to the libraries folder inside of your sketchbook folder otherwise when you update your IDE all the libraries you installed will be lost.

Thanks a lot, Pert!

Especially the hint to instead include Arduino.h was good looking ahead.

BTW: That was the only problem - now it compiles :slight_smile: