xcode Mac OSX Lion/X11/CImg 库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17006245/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:28:02  来源:igfitidea点击:

Mac OSX Lion/X11/CImg Library

xcodemacosx11osx-lion

提问by user1782677

So I'm trying to incorporate the CImg image writing library into my XCode projectHowever, the header file for the library contains the following include and XCode gives this error warning:

所以我试图将 CImg 图像写入库合并到我的XCode 项目中但是,该库的头文件包含以下包含,并且 XCode 给出了此错误警告:

#include <X11/Xlib.h>  Error: File not found

My laptop is running OSX Lion 10.8.2 and apparently, apple took away X11 for Lion, so I went on this siteand downloaded XQuartz because that's what it said to do on the Apple Support page.

我的笔记本电脑运行的是 OSX Lion 10.8.2,显然,苹果为 Lion 拿走了 X11,所以我访问了这个网站并下载了 XQuartz,因为它在Apple 支持页面上说的是这样做的。

So after the installation, I restarted my computer and tried to run my XCode project, but I'm still getting the same exact error on that include.

所以安装后,我重新启动了我的计算机并尝试运行我的 XCode 项目,但我仍然在包含的内容上遇到完全相同的错误。

So I'm not sure what I should do now to fix this. If I search in finder for "XLib.h", it appears and I have a folder called X11 which appears in my finder as well, so I feel like I probably have what I need but I can't figure it out.

所以我不确定我现在应该做什么来解决这个问题。如果我在 finder 中搜索“XLib.h”,它就会出现并且我有一个名为 X11 的文件夹,它也出现在我的 finder 中,所以我觉得我可能有我需要的东西,但我无法弄清楚。

回答by trojanfoe

The header file Xlib.his in /opt/X11/include, so add that path to the Header Search Pathsin Xcode:

头文件Xlib.h在 中/opt/X11/include,因此将该路径添加到Xcode 中的Header Search Paths

enter image description here

在此处输入图片说明

You'll probably need to add libraries from /opt/X11/libas well...

您可能还需要从/opt/X11/lib...中添加库