Reputation: 1096
This has been stumping me for a while. I am trying to create a function that takes a hash table, and returns said hash table. However I am getting this error in the header file,
error: ‘string’ was not declared in this scope.
error: template argument 1 is invalid
Here is the header file itself:
#ifndef NAME_SPAWN_H
#define NAME_SPAWN_H
#include <QString>
#include <QHash>
#include <string>
class Name_Spawn
{
public:
Name_Spawn();
void initalize();
private:
QString int_2_str(int);
void seed();
QHash<string,QString> setTable(QHash<string,QString>);
};
#endif // NAME_SPAWN_H
As you can see, string has been declared. Any ideas? I am at my wits end.
Upvotes: 0
Views: 1002
Reputation: 72431
The real name of string
is std::string
. Try using that instead.
(You can leave off the std::
qualifier only if there's a using namespace std;
directive in scope. But it's a good habit not to put using namespace std;
in header files.)
Upvotes: 6