C++附加控制台包含错误
C++ AttachConsole include error
如何包含 AttachConsole?我总是收到"未在此范围内声明"错误。
我发现这个"要编译使用此函数的应用程序,请将_WIN32_WINNT定义为0x0501或更高版本。有关详细信息,请参阅 MSDN 网站上的使用 Windows 标头"Microsoft但不起作用。
#include <iostream>
#include <stdio.h>
#include <windows.h>
#define _WIN32_WINNT 0x0502
int main() {
AttachConsole(8336);
}
当然,您需要定义_WIN32_WINNT
>= 0x0501,但是您需要在包含Windows标头之前这样做,否则它将没有任何影响。
请改为执行以下操作:
#include <iostream>
#include <stdio.h>
#define _WIN32_WINNT 0x0502
#include <windows.h>
int main() {
AttachConsole(8336);
}
相关文章:
- 在混合代码库中将C转换为C++时出现许多包含错误
- vcpkg 安装 wxWidgts 但得到包含错误
- 为什么我的代码包含错误分段错误(核心转储)?
- clang-cl PCH 缺少标头包含错误
- 特征"Sparse matrix format"示例是否包含错误?
- 如何修复包含错误的错误必须返回值
- MiXiM 包含错误
- CMake 包含错误(找不到文件、未定义引用)
- Mac上的Opencv包含错误
- Bada中未解决的包含错误
- cpp-头文件包含错误
- c++中包含错误的文件
- 多重包含错误
- core_c.h的OpenCV包含错误
- C++ OpenGL:在 glew.h 之前包含错误 gl.h
- C++附加控制台包含错误
- C++代码包含错误
- C++中的递归标头包含错误
- 为什么无符号变量包含错误的值
- VS2010 x64:64位平台VS2010中包含错误数据的对象数组