Hello I have a project that needs an input parser. I keep getting an error and cannot find the problem.
it has been a while since i wrote in C++ and i am not even sure that what i have will work but i cant find out until i get rid of my
error: 'string' does not name a type
the *** show the error line
1 2 3 4 5 6 7 8 9 10 11
#include "inputParse.h"
**std::string inputParse::aAParse(const std::string& userInput, std::string delimiter)
**{
//find the delimiter
pos = userInput.find_first_of(delimiter);
//find where delimiter ends
lastPos = userInput.find_first_not_of(delimiter);
//return the string in between the pos lastPos markers
return userInput.substr(pos, (lastPos - pos));
}
missing the ; won't result in that error....but failing to use std::string instead of string in a file where it is not explicitly said using using would...in this case your header file.
I don't know if it is a better idea to #include <string> . in the header file. Anyone?