Hey guys, I just started learning C++ and I have this code that I have to complete but the class header is giving me this error
error: string: No such file or directory
#include <vector>
#include <string>
class Inventory
{
public:
Inventory ();
void Update (string item, int amount);
void ListByName ();
void ListByQuantity ();
private:
vector<string> items;
};
I don’t think your error is anything to do with namespaces.
You say you’re getting error: string: No such file or directory which implies that the pre-compiler cannot find the STL string definition file. This is quite unlikely if you’re also including vector and having no problems with that.
You should check your compilation output for clues about where it’s picking header files from. Any chance you could post the full compilation output?