Cannot get arduino projects building with vscode ide. Help

First refer to c_cpp_properties.json file removes entries automatically when you close and reopen vscode · Issue #12 · formulahendry/vscode-iot-utility · GitHub
for dissapearing configuration
But im getting lots of things like “fatal error: SPI.h: No such file or directory”
even though they are in the includePath of the c_cpp_properties.json.
This is my first time getting this. Does this even work?

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/cores/arduino",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/variants/mega",
                "c:/src/arduino/TTF_Encoder2/src",
                "c:/src/arduino/TTF_Encoder2/lib/ST7775",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/EEPROM/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/HID/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SoftwareSerial/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/Wire/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Adafruit_CircuitPlayground",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Adafruit_CircuitPlayground/utility",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Bridge/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Esplora/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Ethernet/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Firmata",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Firmata/utility",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/GSM/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Keyboard/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/LiquidCrystal/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Mouse/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/RobotIRremote/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Robot_Control/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Robot_Motor/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/SD/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Servo/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/SpacebrewYun/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Stepper/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/TFT/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Temboo/src",
                "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/WiFi/src",
                "C:/Users/justin/.platformio/packages/toolchain-atmelavr/avr/include",
                "C:/Users/justin/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.9.2/include",
                "C:/Users/justin/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.9.2/include-fixed",
                "C:/Users/justin/.platformio/packages/tool-unity",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": "",
                "path": [
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/cores/arduino",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/variants/mega",
                    "c:/src/arduino/TTF_Encoder2/src",
                    "c:/src/arduino/TTF_Encoder2/lib/ST7775",
                    "c:/src/arduino/TTF_Encoder2/lib/ST7775",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/EEPROM/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/HID/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SPI/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/SoftwareSerial/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/__cores__/arduino/Wire/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Adafruit_CircuitPlayground",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Adafruit_CircuitPlayground/utility",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Bridge/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Esplora/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Ethernet/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Firmata",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Firmata/utility",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/GSM/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Keyboard/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/LiquidCrystal/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Mouse/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/RobotIRremote/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Robot_Control/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Robot_Motor/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/SD/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Servo/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/SpacebrewYun/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Stepper/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/TFT/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/Temboo/src",
                    "C:/Users/justin/.platformio/packages/framework-arduinoavr/libraries/WiFi/src",
                    "C:/Users/justin/.platformio/packages/toolchain-atmelavr/avr/include",
                    "C:/Users/justin/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.9.2/include",
                    "C:/Users/justin/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.9.2/include-fixed",
                    "C:/Users/justin/.platformio/packages/tool-unity",
                    "",
                    "${workspaceRoot}"
                ]
            },
            "defines": [
                "F_CPU=16000000L",
                "PLATFORMIO=30500",
                "ARDUINO_ARCH_AVR",
                "ARDUINO_AVR_MEGA2560",
                "ARDUINO=10619",
                "__AVR_ATmega2560__",
                ""
            ],
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 2
}
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\src\arduino\TTF_Encoder2>set PATH=C:\Users\justin\.platformio\penv\Scripts;C:\Program Files 

....lots of crap...

error: Wire.h: No such file or directory
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\megaatmega2560\lib\Robot_Control\Compass.o] Error 1
*** [.pioenvs\megaatmega2560\lib\Robot_Control\EEPROM_I2C.o] Error 1
In file included from C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\SquawkSD.h:3:0,
from C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\ArduinoRobot.h:24,
from C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Melody.cpp:19:
C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Melody.cpp:25:22: error: 'SQUAWK_PWM_PIN5' was not declared in this scope
SQUAWK_CONSTRUCT_ISR(SQUAWK_PWM_PIN5);
^
C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src/Squawk.h:121:39: note: in definition of macro 'SQUAWK_CONSTRUCT_ISR'
quawk.h:121:39: note: in definition of macro 'SQUAWK_CONSTRUCT_ISR'
intptr_t squawk_register = (intptr_t)&TARGET_REGISTER; \
^                                                                                      de\avr\io.h:99:0,
In file included from c:\users\justin\.platformio\packages\toolchain-atmelavr\avr\inclu:90,
de\avr\io.h:99:0,                                                                      28,
from c:\users\justin\.platformio\packages\toolchain-atmelavr\avr\include\avr\pgmspace.hsrc\Arduino_LCD.h:23,
:90,                                                                                   src\ArduinoRobot.h:22,
from C:\users\justin\.platformio\packages\framework-arduinoavr\cores\arduino/Arduino.h:src\Melody.cpp:19:
28,                                                                                    elody.cpp: In function 'void __vector_17()':
from C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\elody.cpp:25:22: error: 'SQUAWK_PWM_PIN5' was not declared in this scope
src\Arduino_LCD.h:23,
from C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\
src\ArduinoRobot.h:22,                                                                 elody.cpp:25:1: note: in expansion of macro 'SQUAWK_CONSTRUCT_ISR'
from C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\
src\Melody.cpp:19:
C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Melody.cpp: In function 'void __vector_17()':
C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Melody.cpp:25:22: error: 'SQUAWK_PWM_PIN5' was not declared in this scope
SQUAWK_CONSTRUCT_ISR(SQUAWK_PWM_PIN5);
^
C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Melody.cpp:25:1: note: in expansion of macro 'SQUAWK_CONSTRUCT_ISR'
SQUAWK_CONSTRUCT_ISR(SQUAWK_PWM_PIN5);
^
C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Melody.cpp: In member function 'void RobotControl::playMelody(char*)':
C:\users\justin\.platformio\packages\framework-arduinoavr\libraries\Robot_Control\src\Melody.cpp:51:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int n = 0; n < length; n++) {
^
*** [.pioenvs\megaatmega2560\lib\Robot_Control\Melody.o] Error 1
========================================================================================= [ERROR] Took 6.61 seconds =========================================================================================

C:\src\arduino\TTF_Encoder2>





Anyone? (crickets…)

Please add #include <Wire.h> at the top of your main project file.

Actually i had included Wire.h as part of the first line #include <arduino.h>
My issues turned out to be adding the Arduino libaries folder to the lib_extra_dirs option in the platformio.ini
I had to add the base libraries folder and rebuild the intellisense
for windows: home\documents\Arduino\libraries
like this:

[env:nanoatmega328]
lib_extra_dirs = c:\users\user.name\documents\arduino\libraries

If you add a library from the library manager you need this line. Platform IO creates its own copy of the arduino core for building but does not add the external libraries from the library manager to this environment. It adds them to the arduino environment. I think its because its part of the dependent arduino extension

refer Including Arduino libraries together with private libraries [solved]

We highly recommend using PlatformIO Library Manager instead of Arduino IDE. See

haha well, what do you know? i did not even see those icons down the side of the home page.