我在哪里可以获得 Mac 的 windows.h? [英] Where can I get windows.h for Mac?

查看:46
本文介绍了我在哪里可以获得 Mac 的 windows.h?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 MacOSX 上编译我最初在 Windows 操作系统上编写的程序.该程序是一个带有 OpenGL API 等的大型 C++ 程序,总共包含非常多的目录和文件.

I'm trying to compile a program on MacOSX that I originally wrote on a Windows OS. The program is a large C++ program with the OpenGL API among other things, totaling very many directories and files.

Mac 的 OpenGL 最初的编译过程存在问题,因此我下载了 OpenGL 的所有命令行实用程序以使其正常工作.但是正如您想象的那样,OpenGL 下载中的每个 C 文件都有许多预处理器,而我又必须为每个预处理器下载依赖项.

The compilation process at first had a problem with OpenGL for the Mac so I downloaded all the command line utilities of OpenGL for it to work. But as you might imagine, each C file within the OpenGL download had many preprocessors, each of which I in turn had to downloaded the dependencies for.

但是,我还有一个关键步骤:我收到一个致命错误,提示找不到 windows.h 文件.这似乎是 Windows 系统固有的东西(在我庞大的程序目录列表​​中找不到 windows.h 文件),而 Mac 似乎没有 windows.h 的等效文件(http://cboard.cprogramming.com/c-programming/96087-windows-h-mac.html).

However, I have remaining one critical step: I receive a fatal error saying that windows.h file is not found. This seems something inherent to the Windows system (the windows.h file is nowhere to be found in my huge list of directories for the program), and the Mac does not seem to have an equivalent for windows.h (http://cboard.cprogramming.com/c-programming/96087-windows-h-mac.html).

我在为 Mac 编译这个程序时运气不好,还是可以挽救一些东西?

Am I out of luck trying to compile this program for the Mac or can something be salvaged?

推荐答案

你可以做的一件事是创建一个名为 windows.h 的虚拟文件来满足 #include指令,然后通过查看编译器错误日志一一追踪丢失的 typedef、#defines 等.

One thing you can do is create a dummy file called windows.h to satisfy the #include directive, then track down the missing typedefs, #defines, etc. one-by-one by looking at the compiler error log.

Windows.h 是一个整体,包括大约一百个其他 Windows 头文件,但您的程序不需要所有这些定义.这假设您没有直接使用 Windows API,而仅使用诸如 DWORD 之类的简单内容.如果您的软件是使用 GLUT 或 GLFW 之类的框架构建的,这是完全可能的,但如果您直接与 WGL 交互,那么您将有很多工作要做.

Windows.h is monolithic and includes about a hundred other Windows headers, but your program is not going to need all of those definitions. This assumes you are not using the Windows API directly, and only using simple things like DWORD. If your software is built using a framework like GLUT or GLFW that is entirely possible, but if you directly interface with WGL, you are going to have a lot of work ahead of you.

这篇关于我在哪里可以获得 Mac 的 windows.h?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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