#include <Arduino.h> path broken (I think)

Here are my 2 problems:
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\derek\Documents\PlatformIO\Projects\ArduinoUno R3 Detect I2C Address\src\main.cpp).

cannot open source file “avr/pgmspace.h” (dependency of “Arduino.h”)

Here is the output from Platformio: Build

 *  Executing task in folder ArduinoUno R3 Detect I2C Address: C:\Users\derek\.platformio\penv\Scripts\platformio.exe run 

Processing uno (platform: atmelavr; board: uno; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (5.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr @ 5.2.0
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- i2cdetect @ 1.0.0
|-- Wire @ 1.0
Building in release mode
Archiving .pio\build\uno\lib1af\libWire.a
Archiving .pio\build\uno\liba74\libi2cdetect.a
Archiving .pio\build\uno\libFrameworkArduinoVariant.a
Archiving .pio\build\uno\libFrameworkArduino.a
Indexing .pio\build\uno\libFrameworkArduinoVariant.a
Indexing .pio\build\uno\liba74\libi2cdetect.a
Indexing .pio\build\uno\lib1af\libWire.a
Indexing .pio\build\uno\libFrameworkArduino.a
Linking .pio\build\uno\firmware.elf
Checking size .pio\build\uno\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  23.7% (used 486 bytes from 2048 bytes)
Flash: [==        ]  16.5% (used 5326 bytes from 32256 bytes)
==================================================== [SUCCESS] Took 2.34 seconds ====================================================
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task in folder ArduinoUno R3 Detect I2C Address: C:\Users\derek\.platformio\penv\Scripts\platformio.exe run 

Processing uno (platform: atmelavr; board: uno; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (5.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr @ 5.2.0
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- i2cdetect @ 1.0.0
|-- Wire @ 1.0
Building in release mode
Checking size .pio\build\uno\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  23.7% (used 486 bytes from 2048 bytes)
Flash: [==        ]  16.5% (used 5326 bytes from 32256 bytes)
==================================================== [SUCCESS] Took 0.80 seconds ====================================================
 *  Terminal will be reused by tasks, press any key to close it. 

What have I broken that generates the Problems??
I uninstalled Platformio and deleted the ,platformio folder and did a clean build. everything looks OK but I get the issue of the 2 above Problems???

Please advise/ help…much appreciated as always :slight_smile:

  • Does the file C:\Users\derek\.platformio\packages\toolchain-atmelavr\avr\include\avr\pgmspace.h exist?
  • What other VSCode extensions besides PlatformIO do you have installed?
  • What’s the content of the .vscode/c_cpp_properties.json?
  • pgmspace.h exists

  • VSCode extensions:
    Arduino for VSCode
    c/c++ Intellisense
    c/c++ Extension Pack
    c/c++ Runner
    c/c++ Themes
    c Make
    c Make Tools
    Code LLB
    Pylance
    Python
    Serial Monitor

I could not find .vscode/c_cpp_properties.json
The only .json file there is argv (Type JSON source file)

If it helps Platformio hasn’t been the same after I followed the Microsoft tutorial to make my first C++ file in their examples tutorial.

I’ve also got this in the OUTPUT section of the terminal window.
[12/19/2023, 8:59:09 PM] Unable to resolve configuration with compilerPath “C:/msys64/ucrt64/bin/gcc.exe”. Using “cl.exe” instead.
[12/19/2023, 8:59:10 PM] Unable to resolve configuration with compilerPath “C:/msys64/ucrt64/bin/gcc.exe”. Using “cl.exe” instead.

Yikes, then PlatformIO is unable to claim the C++ intellisense for itself. And looking in your extension lists, there are lots of conflicting extensions.

Deactivate or uninstall the “Arduino for VSCode”, “C/C++ Runner”, and “CMake” extensions. Then use Ctrl+Shift+P → Rebuild Intellisense Index to hopefully generate the right .vscode/c_cpp_properties.json.

Hi Max, thanks for your latest reply and help so far…but the plot thickens, and I think the more information I provide as a ‘Newbie’ (before I execute what you advise in uninstalling the extensions) will allow the more skilled and learned of you to analyse events more precisely.
Last night I got things working (don’t ask how) though I think it isn’t fixed properly yet, and realised the problem before was because the Platformio CLI wasn’t being invoked (and additionally Intellisense wasn’t working) as I had noticed the full suite of icons were not being displayed at the bottom of the VSCode screen next to the Platformio home icon.
I now see at the rhs of the screen a Platformio CLI notification.
However ALL this happened because (in my opinion) last week I simply wanted to use VSCode to learn and improve my knowledge of how to use and study C++ under the VSCode IDE.
I followed ‘Get started with VS Code’ under the Walkthroughs on the VSCode Home page, and simply followed the tutorial to write, compile execute the ‘Hello World’ example. In that tutorial is where I added the associated C/C++ extensions.
My limited knowledge led me to believe that I could simply use VSCode to learn C/C++ under this IDE and then simply switch to the Platformio extension when I wanted to…Is this the problem???
My Folder Paths now look like this:
Users/Derek/Documents/Platformio/Projects/.vscode
c_cpp_properties JSON Source File
launch JSON Source File
settings JSON Source File

Users/Derek/Documents/C++/.vscode
c_cpp_properties JSON Source File
launch JSON Source File
settings JSON Source File

My limited but getting better knowledge, reasons that using VSCode in the way I did created the problem I experienced?
I have also now this message in the Terminal when I start VSCode

PS C:\Users\derek\Documents\PlatformIO\Projects\Arduino 7SegLED_Temperature> pio --help
Usage: pio [OPTIONS] COMMAND [ARGS]...

Options:
  --version          Show the version and exit.
  -c, --caller TEXT  Caller ID (service)
  --no-ansi          Do not print ANSI control characters
  -h, --help         Show this message and exit.

Commands:
  access    Manage resource access
  account   Manage PlatformIO account
  boards    Board Explorer
  check     Static Code Analysis
  ci        Continuous Integration
  debug     Unified Debugger
  device    Device manager & Serial/Socket monitor
  home      GUI to manage PlatformIO
  org       Manage organizations
  pkg       Unified Package Manager
  project   Project Manager
  upgrade   Upgrade PlatformIO Core to the latest version
PS C:\Users\derek\Documents\PlatformIO\Projects\Arduino 7SegLED_Temperature>
 *  History restored 

More than happy to help or be corrected on anything so long as I’m learning/improving my understanding.