Hi guys. I'm aware of the requirement to specify std:: as the namespace for string in some way ( whether it be using namespace std etc) - but the following error has stumped me as to its cause.
$ g++ Conf.cpp
Conf.cpp:33: error: ‘string’ in namespace ‘std’ does not name a type
This is the only error - and here is a (truncated) Conf.cpp.
#ifndef Conf_H
#include "Conf.h"
#endif
#include <string.h>
#include "iniparser/iniparser.h"
std::string Conf::getString(const char* name) {/* This is the line causing the error */
std::string rtn;
rtn = string(iniparser_getstring(this->file, name));
return rtn;
}
Line 33 as shown in the code sample is the definition of the function returning a string.
I've tried combinations of using std::string, but each time it states something similar "string does not name a type", "std::string has not been declared" etc..
Any suggestions would be most helpful.
Thanks,
PC_Nerd