WIN32定义在哪里,我如何在我的项目中包含这个定义? [英] Where is WIN32 defined, and how can I include this definition in my project?

查看:910
本文介绍了WIN32定义在哪里,我如何在我的项目中包含这个定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中加入了第三方标题和源文件。

I am including a third party header and source file into my project.

标题顶部有:

#if defined(WIN32) || defined(WIN16)
#ifndef MSDOS
#define MSDOS
#endif
#endif

#include <stdio.h>
#include <stdlib.h>
#ifndef MSDOS
#include <unistd.h>
#endif
#include "des.h"

问题是#if定义(WIN32)失败,编译失败,当尝试#include unistd.h我不想做。

The problem is that #if defined(WIN32) fails and the compilation fails when trying to #include unistd.h which I don't want to do.

我有第三方项目与此头文件,即WIN32被定义,它不试图包括在Visual Studio我在WIN32上做了去定义,并被带到WinDefs.h中的以下定义。

I have third party project that works with this header file i.e. WIN32 is defined and it doesn't try to include In Visual Studio I did "Go To Definition" on "WIN32" and was taken to the following definition in WinDefs.h.

#define WIN32

m不确定这是从其获得WIN32定义,因为第三方项目不显示包括WinDefs.h。

I'm not sure this is where its getting WIN32 definition from, as the third party project does not appear to include "WinDefs.h".

所以我的问题是,如何

推荐答案

取决于您的项目设置。 WIN32是在Windows头文件中定义的,但是你也可以将它传递给编译器(例如-DWIN32)。试试看看它是否编译。

Depends on your project setup. WIN32 is defined inside the windows header files, but you can pass it to the compiler as well ("-DWIN32" for gcc for example). Try it and see whether it compiles.

这篇关于WIN32定义在哪里,我如何在我的项目中包含这个定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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