PlatformIO Community

Problems with finding math.h with VSC intellisense when building Arduino code

I have just started to use PlatformIO with Visual Studio Code (W10) to build Arduino code (Nano 33 BLE) in place of the Arduino IDE. VSC is a much more comprehensive platform and I use it for other types of project anyway so already have it installed.

The problem I’ve got is quite simple - intellisense cannot find the definition of M_SQRT2 so it shows up as undefined. It is there OK, it is in math.h, and that is in C:\Users\USERNAME\.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include. The code does actually build OK, the problem is just with intellisense.

I thought of adding that path to the intellisense include paths, but (1) apparently one shouldn’t as PlatformIO is likely to overwrite it, and (2) the MS VSC C/C++ extension says you do not need to if the compiler path is already defined, and it is.

I suppose I could just ignore it, or define my own #define for it. However, it annoys me that I cannot figure out how to solve it. Any suggestions would be welcome.