I guess I shouldn't have been trying to do this on a Mac though admittedly I only bought a Windows machine recently.
Trying to get Arduino library development on VS Code setup properly has been a bloody nightmare. I thought I had it sorted on my Mac but after a year or so gap between library developments, it doesn't work all of a sudden (the bane of every programmers life I guess).
So I switched to the Windows machine that I have bought in the last year and managed to get it working fairly quickly (I think! Only using a super simple test library generated by ChatGPT so far).
The issue was always that I couldn't get Arduino.h recognised and 'squiggles' working properly.
Adding C:\Users\xxxxx\AppData\Local\Arduino15** helped a lot with the former.
The project settings.json file then added "C_Cpp.errorSquiggles": "enabled" for me
Looks like this is solved. Only took me about 10 years
OK, that should be OK. As you might guess from the avr part of the path, this header is specific to the AVR architecture. However, due to being used in a lot of Arduino code, an avr/pgmspace.h header file has been added to the core of some boards platforms of non-AVR architectures as well for the sake of compatibility. The platform of the Nano 33 IoT is one of those.
When compiling for the Uno, the file is at a path like this:
(the 7.3.0-atmel3.6.1-arduino7 part of the path might be different if you are using an older version of the "Arduino AVR Boards" platform, but you can extrapolate the correct path in that case)
When compiling for the Nano 33 IoT, the file is at a path like this:
Thanks - lets forget about the samd boards for now. The real question is this:
Has anybody at all written an Arduino library with VS Code and if so, how have they done it? Writing the library is of no consequence or difficulty. It is the setting up of th C++ environment in VS Code such that intellisense works perfectly AND the library code builds.
For now I'm just writing sketches. That will do for now. I spent a whole day trying every which way of include paths and VS Code setttings to no avail. I'm sure there is an answer - I just don't have it. I find it hard to believe I cannot find a simple project template in VS Code to write an Arduino library. All the templates are just straightforward library development, but using the Arduino IDE for this is ridiculous and painful. The VS Code templates/examples are for setting up sketch development which is useful for the library examples but not the library itself.
Anyway, here's hoping someone has done it and it is even possible
Am I the first person in the World to do this? Surely not? I'll see if Microsoft can help as I'm guessing some of their engineers will be using VS Code to build Arduino libraries.