And*_*dyL 16 c++ windows mingw g++ visual-studio
Windows XP上的g ++和minGW可以使用Windows SDK吗?
具体来说,为什么g ++无法编译:
#include <stdio.h>
#include <windows.h>
int main(void) {
printf("!!!Hello World!!!");
return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
我尝试通过运行编译:
g++ -c -Wall Test.cpp -IC:/Program\ Files/Microsoft\ Platform\ SDK/Include/
Run Code Online (Sandbox Code Playgroud)
我从一开始就得到了一连串的编译错误
winnt.h:666:2: #error Must define a target architecture.
Run Code Online (Sandbox Code Playgroud)
我已经安装了Windows Server 2003 SP1平台SDK
我正在研究一个大型的实时图像处理软件项目,到目前为止已使用g ++,minGW和gnu make文件(手工编写).对于新功能,我需要与具有专为Visual Studio设计的SDK的帧抓取器连接.framegrabber SDK依赖于Windows SDK中的头文件.
我需要学习Visual Studio还是有其他方法?
小智 13
我使用MinGW每天编译Windows程序,没有问题.您的安装肯定有问题 - 试试Twilight Dragon Media的版本.
编辑:只需重新阅读您的帖子 - 您不需要像往常一样指定包含目录,也可能不应该这样做.此外,您可能(或可能不)需要稍微神秘的-mwindows标志.我刚刚使用MinGW(TDM build)g ++ 4.4.1编译了你的程序,命令行:
g++ main.cpp
Run Code Online (Sandbox Code Playgroud)
绝对没有问题.
更多信息:只是让你知道-mwindows标志的作用,GCC文档说:
此选项可用于Cygwin和MinGW目标.它指定通过指示链接器适当地设置PE头子系统类型来生成GUI应用程序.
就个人而言,我从未发现它是必要的,但我的Windows应用程序都是命令行工具或服务器.