C++ 错误C2679:二进制'<<';:未找到接受类型为';的右操作数的运算符;std::string';(或没有可接受的转换)

C++ 错误C2679:二进制'<<';:未找到接受类型为';的右操作数的运算符;std::string';(或没有可接受的转换),c++,visual-studio-2012,c++11,C++,Visual Studio 2012,C++11,这是我的代码,如何修复此错误 #include "stdafx.h" #include <iostream> using namespace std; int main() { string title = "THE WORLD OF PIRATES"; cout << title << endl; cout << " Welcome to the world of pirates"; cin.get();

这是我的代码,如何修复此错误

#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
    string title = "THE WORLD OF PIRATES";
    cout << title << endl;
    cout << " Welcome to the world of pirates";

    cin.get();

    return 0;
}
#包括“stdafx.h”
#包括
使用名称空间std;
int main()
{
string title=“海盗世界”;
难道你忘了写代码了吗


使用
std::string
而不包含它的头可以在一些编译器上工作,这些编译器间接地将
的一部分导入到它们的
或其他头中,但这不是标准的,不应该依赖。此外,当您尝试输出字符串时,它们通常会中断,因为它们只包含实现的一部分,并且是错误的使用实现
运算符的部分提交问题之前,请使用谷歌查看是否已经存在问题和答案。对于几乎所有标准错误代码,都已经有答案。您可以使用谷歌搜索此网站,只需在搜索栏中添加site:stackoverflow.com。标记为重复,而不引用原创也是毫无意义的。这是谷歌搜索的第一个结果。我已经包括了,它在vs2010中工作,但在vs2015中没有。谢谢!
binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)