'Arduino.h' file not found

Thank you @normandunbar!

In addition to Norman’s excellent response, I’d like to point out that there should NOT be any need to do this. Bar the first time you compile an Arduiono framework project (at which time the files haven’t been downloaded), PlatformIO should tell IntelliSense automatically (when it does the ā€˜IntelliSense Rebuild’) where to find framework related files (i.e. Arduino.h). If it doesn’t it could be that IntelliSense is bugged (yet again), or the cache needs cleaning/rebuilding… hence the presence of the

image

entry. I tended to find out when IntelliSense did go stupid (which is a lot less frequent now) that a combination of rebuilding the index, building the project again, and/or restarting VSCode usually fixed it.

I just did what you said, and it seems that it is working now. I still have a few comments with squiggly red lines under, which is odd, but other than that, everything else seems to work fine.

Thank you @pfeerick and @normandunbar for your valuable help.

Cheers,
Omar

1 Like

I was very glad to learn that the squiggles don’t always mean something.
But I kind of count on them. I guess they usually point out fishy stuff.

Squiggles mean one of three things, maybe 4:

  • The toolchain header files have never been downloaded, so intellisense cannot understand anything related to them.
  • Intellisense knows where the header files are located, and disagrees with something you have typed!
  • Intellisense is borked, and needs rebuilding;

Cheers,
Norm.

1 Like

And when it doubt, repeat number 3 to make it to the 4th entry on the list! :laughing:

IntelliSense is great when it works… which it seems to be getting better and better at doing (hey, the Microsoft C++ extension is only at version 0.27, so it’s got a long way to go before the magic ā€˜1.0’ milestone!!!) … but it has a habit of breaking quite badly a times. Touchwood, not so much of late.

Had this problem in the CLion IDE. Turns out the generated platformio.ini and CMake are wrong.

To fix this, I had to change the platformio.ini from

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino

TO:

[env:Debug]
platform = espressif32
board = featheresp32
framework = arduino

No, this is not necessary. You have to follow the documentation to setup the CMake environments correctly and it’ll work.