I just have a class that takes a string var to a function and outputs the string. For some reason, the compiler is giving me errors. Everything works fine when I use a char var with the function but I get errors when I use strings...here is the program
error:'string' has not been declared in header file
error: no matching function for call to 'Print::PrintString(std::string&) in main file
It is because the header file does not know what a 'string' is. It can't see the #include <string> in the .cpp file or in main. You will need to include the string library in the header file then use std::string for the variable (It is usually a bad idea to have using namespace std in a header as then all other files are forced to use it).