0

I'm trying to compile a simple I2C example to read data from an MPU-6050 accel/gyro sensor, but I'm getting the compilation error:

/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:27:8: error: 'SPISettings' does not name a type
 static SPISettings settings;
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp: In member function 'void Sd2Card::chipSelectHigh()':
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:167:9: error: 'class SPIClass' has no member named 'endTransaction'
 SPI.endTransaction();
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp: In member function 'void Sd2Card::chipSelectLow()':
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:176:9: error: 'class SPIClass' has no member named 'beginTransaction'
 SPI.beginTransaction(settings);
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:176:26: error: 'settings' was not declared in this scope
 SPI.beginTransaction(settings);
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp: In member function 'uint8_t Sd2Card::init(uint8_t, uint8_t)':
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:269:3: error: 'settings' was not declared in this scope
 settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:269:53: error: 'SPISettings' was not declared in this scope
 settings = SPISettings(250000, MSBFIRST, SPI_MODE0);
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:275:7: error: 'class SPIClass' has no member named 'beginTransaction'
 SPI.beginTransaction(settings);
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:279:7: error: 'class SPIClass' has no member named 'endTransaction'
 SPI.endTransaction();
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSckRate(uint8_t)':
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:518:14: error: 'settings' was not declared in this scope
 case 0: settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
 ^
/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp:518:66: error: 'SPISettings' was not declared in this scope
 case 0: settings = SPISettings(25000000, MSBFIRST, SPI_MODE0); break;
 ^
make: *** [.build_ano/uno/SD/src/utility/Sd2Card.o] Error 1
Make failed with code 2

I've commented-out all code until it compiled without error, and I found that the error is caused by the line:

#include <Wire.h>

So my minimal code to reproduce the error is:

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

Why is this include throwing this error? Why is it trying to compile code for accessing an SD card when I have no code that uses that?

I'm using Arduino 1.6.1 and targeting the Uno. I found I can fix this error by copying version 1.0 of the Wire library into my local sketch folder.

asked Jan 31, 2016 at 22:13

2 Answers 2

1

If fixed this by deleting this built-in library

/usr/share/arduino/libraries/SD

but then I received the error:

/usr/share/arduino/libraries/Robot_Control/ArduinoRobot.cpp:25:2: error: 'Serial1' was not declared in this scope
 Serial1.begin(9600);

so I deleted these libraries as well:

/usr/share/arduino/libraries/Robot_Control
/usr/share/arduino/libraries/Robot_Motor

which appear to be buggy in the 1.6 Arduino release. It's still unclear why any of these libraries were being used, since I wasn't including any of their files.

answered May 8, 2016 at 0:56
1
  • Can you elaborate any further on this? I tried these steps and it still isn't working for me. Commented Apr 19, 2017 at 13:36
-1

Try a later version of the IDE. Try making a completely new sketch (don't just delete things from your current one). It looks to me like it is trying to compile things it shouldn't.

/usr/share/arduino/libraries/SD/src/utility/Sd2Card.cpp

That doesn't seem relevant to your empty sketch.

answered Jan 31, 2016 at 22:42
2
  • Yes, it's strange, and yes, it's a completely new sketch. Commented May 8, 2016 at 0:53
  • If a sketch containing #include <Wire.h> and then void setup(){} void loop(){} doesn't compile there is something wrong with your installation. That should compile fine. Try IDE 1.6.8. Commented May 8, 2016 at 7:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.