New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI.cpp includes "pins_arduino.h" unncessarily #1266

nickgammon opened this Issue Feb 5, 2013 · 1 comment


2 participants

nickgammon commented Feb 5, 2013

The file SPI.cpp includes:

#include "pins_arduino.h"
#include "SPI.h"

However SPI.h includes Arduino.h which includes pins_arduino.h. So this additional include would seem to be unnecessary.

This breaks a compile under certain other boards (eg. Bobuino) because of some clash between C and C++ linkage.

See forum thread:,146968

Example code:

#include <SPI.h>
void setup () { }
void loop () { }

Error message:

In file included from /Applications/,
                 from /Applications/
/Users/nick/Documents/Arduino/hardware/maniacbug-mighty-1284p/variants/bobuino/pins_arduino.h:38: error: previous declaration of 'const uint8_t digital_pin_to_timer_PGM [32]' with 'C++' linkage
/Users/nick/Documents/Arduino/hardware/maniacbug-mighty-1284p/cores/standard/Arduino.h:133: error: conflicts with new declaration with 'C' linkage

This comment has been minimized.


Fede85 commented Apr 17, 2013

inside all the pins_arduino.h files contained in the different variants folders we use include guards. This prevents problems associated with double inclusions.

Actually I don't know why the #include "pins_arduino.h" was placed inside the SPI.cpp file and I don't want to remove it to prevent problems with backward compatibility. Using the include guards all the Arduino boards compiles as expected, probably in the Bobuino pins_arduino.h file they forgot to use it.

@Fede85 Fede85 closed this Apr 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment