I'm trying out a the new Visual Studio 2012 Express IDE. I've had no issues with previous versions of the Visual Studio IDE. But this one won't even compile simple programs for some reason. Maybe someone has some advice. Here is a small simple program I tried to compile and run and the associated errors.
Code:
#include <iostream>using namespace std;int main()
{
string words = "Something interesting and bizarre";
cout << words << endl;
words.insert(10, "seriously ");
cout << words << endl;
words.erase(19,16);
cout << words << endl;
words.replace(4, 5, "body");
cout << words << endl;
system("pause");return 0;
}
Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) c:\users\noah\documents\visual studio 2012\projects\testing\testing\test.cpp 8 1 Testing
Ok I found my own issue. Thanks if you looked anyway. Visual Studio requires an include of
It is not really a matter of what particular compiler requires to be included.
You are using the std::string class within your code. By not including <string>, the code is not guaranteed to compile. By including <string>, the code is guaranteed to compile, regardless of the brand of ANSI C++ compiler you're using, whether it is Visual C++, g++, etc.
Bookmarks