Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

cannot open source file "avr32/io.h" #1228

Open
fletchjp opened this issue Apr 12, 2021 · 7 comments
Open

cannot open source file "avr32/io.h" #1228

fletchjp opened this issue Apr 12, 2021 · 7 comments

Comments

@fletchjp
Copy link

I am working with VS Code and the Arduino extension. When I attempt to use a file which include <SPI.h> it fails with an error saying cannot open source file "avr32/io.h". The file works in the Arduino IDE. Several people have reported a similar error on the web and suggest that it is a problem with the ordering of include files.

@adiazulay
Copy link
Contributor

What version of the extension are you using?

@vde69
Copy link

vde69 commented Apr 12, 2021

This problem occurs when libraries have files with names like in the IDE, that is, when linking, it picks up the first file found by name, without taking into account the priorities of the local location of the source. The correct solution would be to first search in the directory hierarchy of the current file and then in the list of included directories. I have this problem occurred when connecting ESP 01, I decided to rearrange the directories.

@fletchjp
Copy link
Author

I am using Arduino 0.4.0 and C/C++ 1.3.0-insiders5

@adiazulay adiazulay added the bug label Apr 12, 2021
@fletchjp
Copy link
Author

I have the error with the example DigitalPotControl which comes with the SPI library to be found in Arduino->hardware->arduino->avr->libraries. I can find nothing to help with this in the Arduino reference for SPI at https://www.arduino.cc/en/Reference/SPI.

The folder Arduino->hardware->tools->avr->avr->include->avr has io.h

I cannot find avr32 anywhere.

@fletchjp
Copy link
Author

I think I have resolved this using the work documented here:
#678
The issue seems to be getting the include files correct.
The critical lines seem to be these, in the Win32 configuration:

            "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\**", 
            "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src", 

The problem is that Intellisense does not generate them. In my main problem case SPI.h was not a top level include.

@fletchjp
Copy link
Author

It also seems to be necessary for this to be searched first:

            "C:\\Users\\User\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\**",

@ed-graham
Copy link

I think I have worked out what is going on here. I've written a full explanation under issue 678.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants