I can use cout to print a normal variable just fine, but whenever I try to print a function variable(in this case, string input
) the compiler shoots out the error:
C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
I have posted my code below. Is there anything that I am doing wrong?(I am using the C++ version of Eclipse)
Here's my code so far:
#include <iostream>
using namespace std;
void println(string text) {
cout << text << endl;
}
int main() {
int test = 5;
cout << test;
return 0;
}