C ++字符串cout错误

时间:2013-08-14 23:04:18

标签: c++

我有这段代码,但它没有正确编译。当我编译这段代码时

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

using namespace std;

int main()
{
    string stringone;
    stringone = "abcdef";
    cout << stringone << endl;
    return 0;
}

编译器告诉我这个错误:

  

错误C2679:二进制'&lt;&lt;' :没有找到哪个运算符采用'std :: string'类型的右手操作数(或者没有可接受的转换)

1 个答案:

答案 0 :(得分:7)

您还需要使用#include <string>

相关问题