PlatformIO Community

Missing Arduino libraries after moving from Atom to VSCode

I used Atom and PIO; the last update killed the monitor.
However, I needed to compile a new program and simply deleted Atom, installed VSCode and PIO.

I was expecting POI would not care, whether it runs on Atom or VSCode; however, I have encountered two problems:

  1. PIO does not find the includes in my Arduino files
  2. IntelliSense is incompatible with compiler path

image

When I look up the built-in libraries, these are all there.

What do I need to do to link these Arduino includes with the source?
And how do I fix the IntelliSense issue?

For example, the CAN bus library is located as specified in platformio.ini
lib_deps = D:\Data\Workspaces\PlatformIO\SpecialLibraries\CAN_BUS_Shield
but it still does not recognise it.

[update 1] deleted /.platformio directory… it reinstalled itself, but made no difference.

[update 2] uninstalled vscode, installed it, install PIO; same result. Problem must be in project files/config???

Does running pio init --ide vscode from the terminal do anything (make sure you’re in the project directory when you run it - not trying to re-initialise some other directory as a platformio project!!)… and then do a build or restart VSCode to liven IntelliSense after running that command.

The more unusual error is the intelliSenseMode one… haven’t seen that one before…

Thanks running this at the project root, creates lib, src and test folders.
as you said, it needs to be run in the respective project folder, here DoorBellGate:


… and it kept the folders it said it would create. So, no change.

To add more info:
My project directory is: D:\Data\Workspaces\PlatformIO\Projects
With these project directories:

I have created a new project: 190731-220031-arduino-blink.
It has <include Arduino.h> w/o a wiggly line.
When I add include <Ethernet.h> it gets a wiggly line

When I go into say the DoorBellGate directory, all include statements will get a wiggly line, and the code does not compile as it cannot find these files.

As per update above, I reinstalled VScode and PIO.
I opened the project folder D:\Data\Workspaces\PlatformIO\Projects and all projects behave the same. There is something missing; I just do not understand what.

when I compile the arduino-blink, I get an unsusal number of success messages, like so:
image

I have got these libraries as built in:

These platforms installed:
image

Built-in:

I think I may have installed the ‘installed’ AVR, because it did not know about the .h files.
[later] uninstalled it, makes no difference.

The Projects.code-workspace also only contains the arduino-blink I created in the projects folder, but does not seem to know about the other projects. this needs updating. How?

OK, I figured that one out. deleted the existing workspace, restarted vscode and opened folder as workspace and saved the workspace, now all are in there.
However, the following (initial) errors are back:

So I can see you’re on Windows… can you check for one of your projects wha the first… say 10 lines of .vscode\c_cpp_properties.json are like?
i.e. D:\Data\Workspaces\PlatformIO\Projects\DoorBellGate\.vscode\c_cpp_properties.json

I’m specifically looking for the name and path style used in the configuration file… if it’s not looking like this…

… this could the the same problem I had the other day, where it got it into it’s head to switch to Linux style paths, and buggered itself up completely. To fix that, I downgraded the C/C++ extension to v0.24.0, as had received an update a few days before… and that seemed to cure it.

Thank you kindly… :slight_smile:
This is what my verison fo this file says:

This seems to be going in the right direction…

I have not opened all projects (the folders under projects, and the ones before reinstalling VScode and PIO do not have a .vscode directory.
These look like htis:

            "name": "Win32",
            "includePath": [
                "d:/MaxG_MyDocuments/PlatformIO/Projects/CanTest_Trans/include",
                "d:/MaxG_MyDocuments/PlatformIO/Projects/CanTest_Trans/src",
                "C:/Users/MaxG/.platformio/lib/CAN_BUS_Shield_ID1210",
                "C:/Users/MaxG/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src",
                "C:/Users/MaxG/.platformio/packages/framework-arduinoavr/cores/arduino",
                "C:/Users/MaxG/.platformio/packages/framework-arduinoavr/variants/standard",
                "C:/Users/MaxG/.platformio/lib/DS1307RTC_ID421",
                "C:/Users/MaxG/.platformio/lib/DallasTemperature_ID54",
                "C:/Users/MaxG/.platformio/lib/EmonLib_ID116",
                "C:/Users/MaxG/.platformio/lib/OneWire_ID1",
                "C:/Users/MaxG/.platformio/lib/PubSubClient_ID89/src",
                "C:/Users/MaxG/.platformio/lib/RF24_ID433",
                "C:/Users/MaxG/.platformio/lib/RF24_ID433/utility",
                "C:/Users/MaxG/.platformio/lib/RTC_ID274/src",
                "C:/Users/MaxG/.platformio/lib/Time_ID44",
                "C:/Users/MaxG/.platformio/lib/WiFiEsp_ID509/src",
                "C:/Users/MaxG/.platformio/lib/WiFi_ID870/src",
                "C:/Users/MaxG/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/EEPROM/src",
                "C:/Users/MaxG/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/HID/src",
                "C:/Users/MaxG/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SoftwareSerial/src",
                "C:/Users/MaxG/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/Wire/src",
                "C:/Users/MaxG/.platformio/packages/tool-unity",
                ""

… and my lib folder (C:/Users/MaxG/.platformio/lib/) is empty.

Would restoring it from a back help; or is there a prescribed way top get potentially other missing files back?

I just noticed a significant difference between .platformio directories (current and backup before re-install):

[update]: have deleted the C:\User\MaxG.platformio folder and restored from backup.

PIO it is still complaining about missing includes.


I was pondering this a bit further, and just noticed this…

image

I think the problem you’re having is because you’ve added the folder containing all the projects, not added the directories themselves… which is why the include paths aren’t quite right… yeah, if I open Projects folder on my end, I get the same problems.

A quick way to test… close the workspace, and add just one project folder to it… and see if it figures things out… again, you might need to let it build the project before it fully works things out. If that works fine, you can do a File -> Add Folder to Workspace, select all the folders under the Projects directory, and then click Add… and it should be fine after that.

Fingers crossed :slight_smile:

1 Like

Thank you soo much! You have no idea how much you’ve helped me out. :+1:
I would have never figured that.

Created a test project
removed the projects folder
saved workspace
added all folders in the ‘projects’ dir

intelliSense started rebuilding…
looking great…

Now I have to figure why the only include missing is ethernet.h???

Will open a new post for this in case I can’t figure it out.

Glad it’s all working for you… that was a tricky one! :smiley:

re: the final issue, which I see you’ve solved… I take it you were using one of the standard Arduino cores, where Ethernet is split out to a separate library? The MightyCore and MegaCore cores look like they provide their own copy, but pretty sure most of the others use the stock Arduino library, which isn’t bundled with the core so it can update separately.