NB, C++ beginner here, but I have reasonable experience coding in other languages (and significantly less sophisticated development environments).
I am working in visual studio using visual micro to work on an arduino project. The details of the project are not important, as, at this point, I am encountering the error in a completely empty .ino/.cpp file:
fatal error: string: No such file or directory #include <string>
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ^~~~~~~~ compilation terminatedAn error was encountered during the 'Deep Search' library discovery process. Build failed for project 'CylinderPrinter'
#include <string>
// the setup function runs once when you press reset or power the board
void setup() {
string h = "";
}
// the loop function runs over and over again until power down or reset
void loop() {
}
I have tried a number of things so far, as this seems to be a somewhat common error:
- Most permutations of: #include "string"; #include "string.h"; #include ; #include ; #include <string.h>; using namespace std (which is apparently bad practice); etc.
- Including both the "string" and "string.h" dependencies within my project, rather than referencing them as external dependencies (in this case, the compiler marks 'string is undefined in this scope')
- Calling string as std::string to avoid namespace issues (compiler states 'string is not a member of std')
- Altering the target paths in the compiler window (admittedly I have no idea what I am doing here, so I could probably use some advice...)
- Reinstalling the Visual C++ redistributable (I have tried x86 and x64...)
- Restarting my code in a new project
- Restarting my code in the arduino development environment (same error, which I imagine suggests a systemic problem).
As far as I can tell, I have made no meaningful progress. Here are some additional screenshots that could possibly be helpful:
- Screenshot of Debug Properties: VC++ Directories
- Screenshot of solution explorer
- Screenshot of Debug Properties: General
- Screenshot showing that C++ distributable is installed
Please let me know if there's additional information that could prove helpful.
... . . . ...