Hello. You must pass a string data type parameter to the class method. There is a definition in the DoubleVector.cpp file

void CDoubleVector::saveResult(std::string FileName){} 

Also in the DoubleVector.h header file

 void saveResult(string FileName); 

So here. Does not work.

Error C2061 syntax error: identifier "string" c: \ users \ alexey \ documents \ visual studio 2015 \ projects \ oop_labwork4 \ oop_labwork4 \ doublevector.h 23

If you change the string to std :: string in the header file, it does not become better (which is quite logical) and gives an error:

Error C2039 string: not a member of "std" c: \ users \ alexey \ documents \ visual studio 2015 \ projects \ oop_labwork4 \ oop_labwork4 \ doublevector.h 23

So how can you normally pass a string to a parameter?

  • Dumb question: #include <string> did not try to write? - Harry
  • @Harry, how silly it does not sound, I did not write it correctly. Instead of string, the obsolete string.h printed. Now everything seems to be working fine. Thank. - Desmond Fox
  • Well, then make out as an answer :) - Harry
  • Good. Thanks again. - Desmond Fox

1 answer 1

Do not confuse

 #include <string> 

and

 #include <string.h>