[英]cout print string variable cannot pass the build
Could any one help me to figure out which the following code cannot build successfully: 谁能帮助我找出以下代码无法成功构建的地方:
#include <iostream>
int main(void){
std::string str1("sfsfasfdsdf");
std::cout << str1 << std::endl;
return 1;
}
Thanks. 谢谢。
You have to include std::string
header: 您必须包括std::string
标头:
#include <string>
EDIT : According to @ShafikYaghmour's comments, include iostream
sometimes brings in string
, but it may not be the case for you if you only have the posted code. 编辑 :根据@ShafikYaghmour的评论,include iostream
有时会带来string
,但是如果您只有已发布的代码,对于您而言可能并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.