This thread seems to have died away. Let me attempt to revive it.
Here is the code
File: "name.hpp"
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef NAME_HPP_
#define NAME_HPP_
#include <string>
class Name {
private:
string name;
public:
Name();
};
#endif /* NAME_HPP_ */
File: "name.cpp"
1 2 3 4
#include "name.hpp"
Name::Name() {
}
And the errors:
Description Resource Path Location Type
'string' does not name a type name.hpp /hw line 15 C/C++ Problem
Type 'string' could not be resolved name.hpp /hw line 15 Semantic Error
WTF IS WRONG WITH THIS CODE? (sorry to shout, this is frustrating)
As it so happens, if I copy it to the file where the "main()" function is located, then it's perfectly happy.
Thank you @bluecoder! Any particular reason to include both the "using namespace std" directive and the "std::" scope identifier?
I was getting to ready to come in screaming and yelling, because I tried it again on a different machine, but this time I was getting "'string' does not name a type".
I was all up and typing in my complaint, when I noticed the examples above: "#include <string>".
Oops! A little something I seemed to have forgotten!