Hello everyone. Happy New Year 2020!
I have been using Visual Studio Code for development on my Arduino Uno. The reason being, is that you can get nice syntax highlighting, linting, and other fancy IDE features which makes programming in C++ more efficient.
Visual Studio Code has this rather impressive extension called 'PlatformIO'. It is basically an all-in-one solution for development with different micro-controllers, including Arduinos. Upon creating a new project, it will automatically install the needed drivers and standard arduino libraries for you, as well as generate a configuration file that is needed to compile and upload the code.
The only problem I have have with PlatformIO, is that it doesn't seem to detect the standard c++ library. I'll #include vector
for example, and it will say that the header files cannot be found. This is only a unique issue to the Arduino workspace environment. You can generate a normal workspace in VScode and use all the standard C++ libraries without a problem.
So I know that C++ libraries are installed. I can even see it under the installed extensions list in VScode. It seems that the PlatformIO configuration doesn't know how to locate it and I'm not exactly sure how to configure it manually.
There seems to be build options according to PlatformIO's documentation, you just need to edit the platformio.ini configuration file. The problem is, the default configuration file doesn't actually generate any default build options within it, and I am not exactly sure what compiler it is using.
Does it use the MSVC compiler or the GCC compiler? And does it makes a difference for building Arduino compatible code?
Additionally, I don't know where VScode installs whatever C++ library it is using, so I'm not really sure how to tell PlatformIO where to look.
Yesterday, I spent some time taking the C++ library header files from a MinGW installation and copying them to the "include" folder that PlatformIO creates in the workspace. I was able to detect some of the headers, but it could not find some of the dependencies for the libraries either. Unfortunately, this did not get me anywhere useful and I still could not include the header file.
Even if this did work, it would only be a temporary solution. I would have to do this each time when creating a new Arduino project with PlatformIO, since the include folder would need these header files once again.
Is there an easy way I can configure platformIO to use the standard C++ libraries by default?
I am thankful for any feedback.