Question: I am getting the following error: In function `operator>>(std::istream&, Accident&)': Accident.cpp:(.text+0xe3b): undefined reference to `readDoubleQuotedString[abi:cxx11](std::istream&)' Here is my relevant code: std::istream& operator >>(std::istream &is, Accident
I am getting the following error:
In function `operator>>(std::istream&, Accident&)':
Accident.cpp:(.text+0xe3b): undefined reference to `readDoubleQuotedString[abi:cxx11](std::istream&)'
Here is my relevant code:
std::istream& operator >>(std::istream &is, Accident &aar) { //instream operator char dash; string eID, cty, st, ctry, iType, aNum, mm, rNum; int iF, iS, iM, iN; Date eDt; Time eTm; if (!is) { throw invalid_argument("The input stream is initially in a failed state."); } //input data into variables and use readDoubleQuoted string for multiple word strings is >> eID; cty = readDoubleQuotedString(is); is >> st >> ctry >> iType >> aNum >> eDt >> dash >> eTm >> rNum >> iN >> iM >> iS; //set each actual variable with the values contained in the temporary ones aar.setEventID(eID); aar.setCity(cty); aar.setState(st); aar.setCountry(ctry); aar.setInvestigationType(iType); aar.setAccidentNumber(aNum); aar.setEventDate(eDt); aar.setEventTime(eTm); aar.setCountInjuredSerious(iS); aar.setCountInjuredMinor(iM); aar.setCountNonInjured(iN); aar.setMakeAndModel(mm); aar.setRegistrationNumber(rNum); return is; } std::string readDoubleQuotedString (std::istream is) { char x; //for quotation marks string y; //store full string of information if (!is) { //if input stream is in failed state, throw error throw invalid_argument("Error"); } is >> x; //store first char in x if( x != '\"') { //check if x is " throw std::logic_error("Error: Quotation marks not found."); } getline(is, y, '\"'); //store string in y until next quotation marks return y; //return full string } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
