Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic "SPI.h: No such file or directory" for Feather 32u4 (Read 5753 times)
Craig Graham
Newbies
*
Offline


Posts: 6
Joined: May 1st, 2018
"SPI.h: No such file or directory" for Feather 32u4
Aug 29th, 2018 at 12:00pm
Print Post  
I'm having trouble building for a Feather 32u4 in Visual Micro. A sketch that simply has #include <SPI.h> added to the default template compiles fine in the Arduino IDE and throws this error in Visual Micro. Visual Micro is able to compile if the board is set to one of the standard Arduino ones.

I've tried removing the Adafruit packages from within Visual Micro and installing them again from there, no change. The board shows up in the dropdown list but obviously something's not right.

I do have a nonstandard sketchbook location in Visual Micro. I've removed it, no change. I've also tried the Arduino IDE with a variety of sketchbook locations, including an empty directory, and it still compiles fine. Tried turning "Deep search" off as something to try. No change. If Verbose is enabled, the build output is

Code
Select All
Compiling 'FeatherGate' for 'Adafruit Feather 32u4'
Build Folder: t_avr_feather32u4/Release"
Summary: Header=1 Prototypes=3 Imports=0
Additional Defines:
Architecture Tools: .9.2-atmel3.5.4-arduino2/bin/"
Api: 1.1806.1-5
Sketch Book: "file:///C:/Work/Arduino"
Sketch Include Paths
Core Include Paths
Include Path "file:///C:/Program%20Files%20(x86)/Arduino/hardware/arduino/avr/cores/arduino"
Include Path .4.13/variants/feather32u4"

Deep search for libraries ...
el3.5.4-arduino2\bin\avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega32u4   -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C -DUSB_MANUFACTURER="\"Adafruit\"" -DUSB_PRODUCT="\"Feather 32u4\"" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" variants\feather32u4" ather32u4\Release\FeatherGate.cpp" -o "nul"
el3.5.4-arduino2\bin\avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega32u4   -DF_CPU=8000000L -DARDUINO=10801 -DARDUINO_AVR_FEATHER32U4 -DARDUINO_ARCH_AVR -DUSB_VID=0x239A -DUSB_PID=0x800C -DUSB_MANUFACTURER="\"Adafruit\"" -DUSB_PRODUCT="\"Feather 32u4\"" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" variants\feather32u4" ather32u4\Release\FeatherGate.cpp" -o "nul"

FeatherGate.ino: 22:17: fatal error: SPI.h: No such file or directory
   #include <SPI.h>
   compilation terminated
Build failed for project 'FeatherGate'
 



Bit stumped now. Where can I go from here?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: "SPI.h: No such file or directory" for Feather 32u4
Reply #1 - Aug 29th, 2018 at 12:23pm
Print Post  
To be clear please remove the non-standard sketchbook folder from visual micro then restart the ide and try the build.

If you do not have an #include for SPI.h in the .ino code then ensure deep search is enabled.

The sketchbook folder also specifies the \libraries folder location. I an currently unclear if the ardfruit board has it's own spi library or if it uses the standard one from sketchbook\libraries

Switching on vmicro>compiler>verbose and then "show build properties" prior to a build will give a better output for us to see the issue. Please attach the output as a .txt file to this thread of email to info[at]visualmicro.com along with a link to this thread

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: "SPI.h: No such file or directory" for Feather 32u4
Reply #2 - Aug 30th, 2018 at 3:59am
Print Post  
Is it possible you have used the visual micro NO IDE option? SPI comes with the arduino ide unless you have downloaded it from the web or your hardware includes it.

Which ide option in visual micro have you used?
  
Back to top
IP Logged
 
Craig Graham
Newbies
*
Offline


Posts: 6
Joined: May 1st, 2018
Re: "SPI.h: No such file or directory" for Feather 32u4
Reply #3 - Sep 5th, 2018 at 2:14pm
Print Post  
1.6/1.8. I've successfully built stuff for other Arduinos with this, and I can build this code if I change the target to one of the standard Arduino boards. And I can build in the Arduino IDE so I'm back to developing in there for the moment, but it'd be nice to get this to work.
  
Back to top
 
IP Logged
 
Craig Graham
Newbies
*
Offline


Posts: 6
Joined: May 1st, 2018
Re: "SPI.h: No such file or directory" for Feather 32u4
Reply #4 - Sep 5th, 2018 at 2:18pm
Print Post  
Btw yes SPI comes with Arduino but my understanding is it's quite processor dependent, so there's interesting stuff happening under the hood so the right SPI stuff is brought in for the target. That's what I gathered from replies to other people elsewhere having this error and wanting to just download a generic Arduino SPI.h file.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: "SPI.h: No such file or directory" for Feather 32u4
Reply #5 - Sep 7th, 2018 at 10:47am
Print Post  
Yes you need to use the arduino ide option in visual micro, not (No IDE) or you would need to use Library Manager to download the correct spi lib.

I suggest you ensure you have arduino 1.6/1.8 selected in visual micro. Then click build>clean to be sure of a clean build.

Our of interest. How is the spi lib included in the code? #include <spi.h> or #include "spi.h"
  
Back to top
IP Logged
 
iraytrace
Newbies
*
Offline


Posts: 1
Joined: Oct 16th, 2018
SOLVED: Re: "SPI.h: No such file or directory" for Feather 32u4
Reply #6 - Oct 16th, 2018 at 2:37am
Print Post  
I had the same problem for several days.  To recap, this code doesn't compile because SPI.h isn't found:
Code
Select All
#include <SPI.h>
void setup() { }
void loop() { } 


To fix the Visual Micro install within Visual Studio:
Select the vMicro->Visual Micro Explorer menu:
Select the Manage Boards tab:
Under Board Platform Installer there was an Available Updates entry.  Install the following updates:

Arduino AVR Boards version 1.6.23
Adafruit AVR Boards Version 1.4.13 

After this I was able to compile the above code.
« Last Edit: Oct 16th, 2018 at 2:39am by iraytrace »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: "SPI.h: No such file or directory" for Feather 32u4
Reply #7 - Oct 16th, 2018 at 11:44am
Print Post  
Hi iraytrace,

If you use the (No IDE) option then your code will not have the libraries that are installed with the Arduino IDE.

The search order for libraries is

1. Sketchbook\Libraries
2. Platform Folder\Libraries
3. Ide Folder\Libraries

Therefore I assume that you are using the No IDE option and that you needed a platform installed that had an SPI library which in your case was the AVR platform.



« Last Edit: Oct 16th, 2018 at 11:44am by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint