C++ C++;附件控制台包含错误
如何包括AttachConsole?我总是得到“未在此范围内声明”错误 我在Microsoft MSDN上发现了以下内容:“若要编译使用此函数的应用程序,请将_WIN32_WINNT定义为0x0501或更高版本。有关详细信息,请参阅使用Windows标题。”但不起作用C++ C++;附件控制台包含错误,c++,windows,user-interface,console,C++,Windows,User Interface,Console,如何包括AttachConsole?我总是得到“未在此范围内声明”错误 我在Microsoft MSDN上发现了以下内容:“若要编译使用此函数的应用程序,请将_WIN32_WINNT定义为0x0501或更高版本。有关详细信息,请参阅使用Windows标题。”但不起作用 #include <iostream> #include <stdio.h> #include <windows.h> #define _WIN32_WINNT 0x0502 int mai
#include <iostream>
#include <stdio.h>
#include <windows.h>
#define _WIN32_WINNT 0x0502
int main() {
AttachConsole(8336);
}
#包括
#包括
#包括
#定义_WIN32_WINNT 0x0502
int main(){
附件控制台(8336);
}
当然,您需要将\u WIN32\u WINNT
定义为>=0x0501,但您需要在包含Windows标题之前执行,否则它将毫无效果
改为这样做:
#include <iostream>
#include <stdio.h>
#define _WIN32_WINNT 0x0502
#include <windows.h>
int main() {
AttachConsole(8336);
}
#包括
#包括
#定义_WIN32_WINNT 0x0502
#包括
int main(){
附件控制台(8336);
}
oh f*ck:D我已经试了好几个小时了D