I can't get any SPI sketch to compile on Raspberry Pi 3 running Debian 8. Always the same compile error. I just reinstalled Arduino, again. Same error every time. What's wrong?
SPI_BusDemo.cpp.o: In function loop': /usr/share/arduino/Mouse_Hack.ino:34: undefined reference to SPIClass::begin()'
collect2: error: ld returned 1 exit status
#include "SPI.h" // necessary library
int ss=10; // using digital pin 10 for SPI slave select
int del=200; // used for various delays
void setup()
{
pinMode(ss, OUTPUT); // we use this for SS pin
SPI.begin(); // wake up the SPI bus.
SPI.setBitOrder(MSBFIRST);
// our MCP4162 requires data to be sent MSB (most significant byte) first
}
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.
We need the FULL error output to help you. When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.
Part of why I wanted you to post the error message following my instructions is because it would also have shown which version of the Arduino IDE and which board you're compiling for, so what are they?
I've tried right-clicking everything all over the right, left and middle of the error message. And nothing comes up. I think something must be wrong with the installation.
The top of the sketch window says, Arduino 2:1.0.5+dfsg2.4
When I first got the compile error, I used the terminal to uninstal the existing Arduino.
Then I downloaded Arduino-1.8.1 (for Linux 32-bit, Raspberry Pi3), and followed Arduino's instructions to install it. That makes a desktop icon, but the program will never launch. It churns for a minute and then nothing.
So, from the terminal, I used
sudo apt-get install arduino
And that's the version of Arduino (2:1.0.5+dfsg2.4) I'm using that won't compile for SPI. But it does seems to work for every other sketch I've tried.
The reason the Debian package manager doesn't have the current Arduino IDE version is that there is an issue with the license documentation for newer versions of the Arduino IDE and they are super picky about everything being proper before allowing it in. My understanding is 1.0.5+dsfg2 is actually even a bit different from the official 1.0.5 release. So the reason you don't see a "Copy error messages" button on the orange bar is that feature didn't exist so far back as 1.0.5. I just tried your sketch on 1.0.5-r2 compiled for Uno and it has no errors. So unfortunately I am stumped since I can't reproduce your issue but I'm also not using the exact version of the IDE as you and not running Linux so I can't try it with 1.0.5+dsfg2.
I would definitely advise you to figure out how to get a more recent version of the Arduino IDE running on your system. I don't know whether that would solve your problem but there has been a lot of progress in development since 1.0.5. 1.8.1 seems to be a pretty well done release. Maybe someone with experience with running the IDE on Raspberry Pi can help out. All I know is you need the "Linux ARM" download from the download page, did you use that one?