<分区>
我收到错误“错误:‘cout’未在此范围内声明”,但我包含了 <iostream>
,这是我研究中针对类似问题给出的解决方案。我的代码是这样的:
#include <iostream>
int main(){
Sally so;
Cout << "omg wtf is this on my shoe" << endl;
}
标签 c++
<分区>
我收到错误“错误:‘cout’未在此范围内声明”,但我包含了 <iostream>
,这是我研究中针对类似问题给出的解决方案。我的代码是这样的:
#include <iostream>
int main(){
Sally so;
Cout << "omg wtf is this on my shoe" << endl;
}
最佳答案
cout
不是 Cout
,请注意大小写差异。cout
在命名空间 std
中.为了使用它,您需要使用 std::
解析 namespace 。 , 所以使用 std::cout << ...
.using namespace std
, 不要。更多信息,see Why is “using namespace std” considered bad practice?. 关于c++ - 在 C++ 中出现 "scope"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42515509/