g++/minGW 可以与 Windows SDK 配合使用吗?Visual Studio 是唯一的选择吗? [英] Can g++ / minGW play nice with the Windows SDK? Is Visual Studio the only option?

查看:22
本文介绍了g++/minGW 可以与 Windows SDK 配合使用吗?Visual Studio 是唯一的选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows XP 上的 g++ 和 minGW 可以使用 Windows SDK 吗?

Can g++ and minGW on Windows XP use the Windows SDK?

具体来说,为什么g++编译失败:

Specifically, why does g++ fail to compile:

#include <stdio.h>
#include <windows.h>

int main(void) {
 printf("!!!Hello World!!!");
 return EXIT_SUCCESS;
}

我尝试通过运行编译:

g++ -c -Wall  Test.cpp -IC:/Program Files/Microsoft Platform SDK/Include/

我收到一连串以

winnt.h:666:2: #error Must define a target architecture.

我已经安装了 Windows Server 2003 SP1 平台 SDK

我正在开发一个大型实时图像处理软件项目,到目前为止,该项目一直使用 g++、minGW 和 gnu 制作文件(手写).对于一个新功能,我需要与一个具有 frame grabber 的接口="http://www.bitflow.com/index.php/SDK" rel="noreferrer">为 Visual Studio 设计的 SDK.framegrabber SDK 依赖于 Windows SDK 的头文件.

I am working on a large real-time image processing software project that up until now has used g++, minGW and gnu make files (written by hand). For a new feature, I need to interface with a frame grabber that has an SDK which was designed for Visual Studio. The framegrabber SDK depends on header files from the Windows SDK.

我需要学习 Visual Studio 还是有其他方法?

Do I need to learn Visual Studio or is there another way?

推荐答案

我每天都用MinGW编译Windows程序,零问题.您的安装一定有问题 - 请尝试 暮光龙传媒 上的版本.

I use MinGW to compile Windows programs every day, with zero problems. There must be something wrong with your installation - try the version at Twilight Dragon Media.

只需重新阅读您的帖子 - 您不需要指定包含目录,并且可能不应该这样做.此外,您可能(也可能不需要)有点神秘的 -mwindows 标志.我刚刚使用 MinGW (TDM build) g++ 4.4.1 编译了你的程序,命令行:

Just re-read your post - you do not need to specify the include directory as you are doing, and probably should not do so. Also, you may (or may not) need the slightly mysterious -mwindows flag. I just compiled your program using MinGW (TDM build) g++ 4.4.1, with the command line:

g++ main.cpp

绝对没有问题.

更多信息:你知道 -mwindows 标志的作用,GCC 文档说:

More Info: Just so you know what the -mwindows flag does, the GCC docs say:

此选项适用于 Cygwin 和MinGW 目标.它指定一个 GUI应用程序将由指示链接器设置适当的 PE 头子系统类型.

This option is available for Cygwin and MinGW targets.It specifes that a GUI application is to be generated by instructing the linker to set the PE header subsystem type appropriately.

就我个人而言,我从来没有发现它有必要,但我的 Windows 应用程序都是命令行工具或服务器.

Personally, I've never found it necessary, but then my Windows apps are all command line tools or servers.

这篇关于g++/minGW 可以与 Windows SDK 配合使用吗?Visual Studio 是唯一的选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆