本文介绍了在Mac OSX 10.11.6的XCode中使用CImg标头时出现X11问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在标题搜索路径,库搜索路径中添加了X11,并在XCode的构建设置和构建阶段中将二进制文件链接到X11库,但是仍然出现下图所示的错误.我是99.999%,确定问题是X11,因为当我禁用显示功能时,警告不存在.关于下一步我可以做什么?

I added X11 to my header search paths, library search paths, and I linked the binary to the X11 library in the build settings and build phases in XCode however I am still getting the errors shown in the picture below. I am 99.999% Sure the problem is X11 because when I disable the display capabilities the warnings aren't there. Any ideas on what I can do next?

推荐答案

我认为您的构建设置有些不正确.这是一个入门的非常简单的程序-您可以选择使用libpnglibtifflibjpeg显示PNG,TIFF或JPEG文件,我假设您已使用 homebrew 与:

I think you have your build settings a little incorrect. Here is a very simple program to get you started - you can choose to display PNG, TIFF or JPEG files by using libpng, libtiff or libjpeg which I am assuming you have installed using homebrew with:

brew install libpng libjpeg libtiff

这是代码:

#define cimg_display  1
#define cimg_use_png  1
#define cimg_use_tiff 1
#define cimg_use_jpeg 1

#include "CImg.h"
using namespace cimg_library;

int main() {
    // Load image
    CImg<unsigned char> image("/Users/mark/Desktop/test.tif");

    // CImg<unsigned char> image("/Users/mark/Desktop/test.png");
    // CImg<unsigned char> image("/Users/mark/Desktop/test.jpg");
    // CImg<unsigned char> image("/Users/mark/Desktop/test.pnm");

    image.display();
}

唯一需要的构建设置如下:

The only build settings needed are as follows:

/Users/mark/src/CImg用于我使用git管理的CImg.h头文件,并使其与GitHub上的CImg分发保持同步.

The /Users/mark/src/CImg one is for the CImg.h header file I manage with git, keeping it in sync with the CImg distribution on GitHub.

请注意以下几点:

  • CImg可以读取NetPBM(PGM/PBM/PPM和实际PFM)图像,而无需任何额外的代码,库或依赖项

  • CImg can read NetPBM (PGM/PBM/PPM and actually PFM) images without any extra code or libraries or dependencies

CImg可以通过#define cimg_use_tiff#define cimg_use_png#define cimg_use_jpeg读取TIFF,PNG,JPEG,而无需ImageMagick,只要您设置了包含路径,库路径和库名称即可,如上所示

CImg can read TIFF, PNG, JPEG without needing ImageMagick if you #define cimg_use_tiff or #define cimg_use_png or #define cimg_use_jpeg as long as you set the include path the library path and the library names as I have shown above.

CImg可以读取 ImageMagick 可以读取的任何内容.

CImg can read anything that ImageMagick can read if you install that package.

这篇关于在Mac OSX 10.11.6的XCode中使用CImg标头时出现X11问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 06:24