visual studio 2012 c++ no cout
visual studio 2012 c++ no cout
我正在尝试学习c++,但不存在像"cout"answers"cin"这样的简单方法这是我的代码:
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
cout>>"hello";
return 0;
}
有一个错误,上面写着"错误C2065:‘cout’:未声明的标识符"
和"IntelliSense:标识符"cout"未定义"
cout
在std
命名空间中声明:
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "hello";
return 0;
}
你也做错了。注意上面的尖括号。
将#include <iostream>
添加到stdafx.h
。我遇到了麻烦,这对我很有效。
添加using namespace std;
可能会有所帮助,也可以执行cout << "hello"
而不是>>
。
cout
在std
中,因此您必须使用using namespace std
。而对于cout
,运算符与<<
类似。>>
这是用于输入的,即cin
。
#include "stdafx.h";
#include "iostream";
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout<<"hello";
system("pause");
return 0;
}
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- std::cout.imbue()多重调用
- 如何在C++中用std::cout正确显示带十六进制的字符串文本
- 为什么在C的循环中使用printf的Rust代码不显示输出,而在C++的循环中显示std::cout
- 为什么我应该在异常处理中使用std::cerr而不是std::cout
- c++20[[no.unique_address]]中的新功能是什么
- 以线程安全的方式调用"QQuickPaintedItem::updateImage(const QImage&image)"(no QThread)
- 在作为静态成员包含在另一个类中的类的构造函数中使用 cout
- "no matching function for call to 'Vector::Vector'"错误
- 在 COUT 语句中使用 COUT 调用函数
- GCC 4.8.2 自动矢量化由于 cout 而失败
- Android NDK clang 编译器错误在 Windows 上显示'No such file or directory'
- std::cout输出int时出现编译错误
- 在这种情况下显式调用时,std::cout 如何更改析构函数的行为?
- C++ Setter/Getter,cout 工作,printf 失败
- C++ cout 将双精度对齐到精度 2 并正确对齐
- 如何修复" no match for 'operator<<' in 'std::cout"错误?
- visual studio 2012 c++ no cout