I’ve encountered a frustrating issue while trying to write for the Arduino Uno board. Strangely, while all arduino-related libraries are found with no issues, my basic c++ libraries are apparently not found by platfomio/linter-gcc. “#include < string >” and “#include < iostream >”, for example, elicit “no such file or directory” errors from linter-gcc and generate fatal compilation errors upon attempts at building/uploading (these operations work fine with the above ‘includes’ commented out). In addition to appearing in my pre-existing code, these errors also appear in newly initialized platformio projects in files whose sole line of code is the ‘include’ statement (I’ve made sure to rebuild the files per suggestion on platformio’s main page). Compiling in windows cmd using g++, however, produces no issues as well as successfully functioning .exe files. I understand there are workarounds to these issues, namely avoiding the use of basic libraries/adding those libraries to the .json configuration file (would this work?) but I’m looking for a more permanent fix if possible. I’ve tried following the windows setup guide for linter-gcc (Windows Users Guide · AtomLinter/linter-gcc Wiki · GitHub) to address the linting errors but this too has failed, despite following instruction to the T (GCC exec path is g++.exe and C:\MinGW\bin is the final item in windows PATH). I have MinGW 32/64 bit version installed. Thanks in advance for your help. As I’m relatively new to all this I allow that I may have forgotten to include some crucial bits of information and am happy to provide whatever’s needed to make all of this go away.
- Try to rename CPP headers to
- PlatformIO IDE
Menu: Rebuild C/C++ Index
Thanks so much for the quick reply. Are you suggesting a change in coding from e.g. “#include < string >” to "#include “string.hpp” or are you suggesting a name change for library files themselves or both? I tried substituting #include “string.hpp” for #include < string > and that hasn’t proved successful even with rebuilding.
Could you share here
platformio.ini? What is your development platform? Also, if you could share test project, it would be better. You can contact via PM here.
My apologies, where can I PM you? Can’t find any option on the forum page.
PM link appeared and then disappeared…
I’ll just reply here for now, thanks again for your help, sorry for the trouble.
[env:uno] platform = atmelavr framework = arduino board = uno
I’m using a windows 10 lenovo thinkpad x1 carbon (hopefully that answers fully your dev platform question). Not sure how to share the test project I made… I initialized a new Arduino Uno project and saved a .cpp file with the single line "#include " in its src folder. I then rebuilt the c/c++ project index and attempted to save and compile without success.
Menu: Project examples > atmelavr-and-arduino/arduino-external-libs
Could you try this project? Do you have the same errors?
OneWire.h is unfound.
Strange message. Please upgrade to the latest IDE and CLI that have been just released
Do you still see these errors?
I had to reopen to this discussion after a while as I already googled a lot but couldn’t find a way to solve my problem and this thread seems to be related to the issues I’m having.
I am getting the same errors while trying to compile code with
#include <time.h> and
#include <string> functions. It’s strange because the same code was compiling just fine earlier this week, so I would say something messed up with my libraries path.
I 've already tried:
- Updating Platformio
- Reinstalling it to VSCode
- Rebuilding Intellisense Index
- Creating another project and just moving my source files (and including my dependencies in lib_deps section in platformio.ini)
Does anybody have some clue on how can I solve this?