' jpeglib.h'文件未找到

时间:2015-10-16 10:31:48

标签: c++ xcode macos libjpeg

我正在尝试用c ++读取jpg图像。我按照此链接libjpg的建议下载了https://www.opengl.org/wiki/Image_Libraries并安装了它。虽然当我包含库Xcode失败时,建立说' jpeglib.h'找不到文件

#include <jpeglib.h>

我可以在/ usr / local / include /目录中看到标题,这样我就无法理解为什么Xcode不会看到它。

操作系统和软件详细信息:

OSX 10.11(El Capitan)

Xcode 7.0.1

编辑:

find /usr/local -name \*jpeg\* -print -name \*jpg\* -print
/usr/local/bin/cjpeg
/usr/local/bin/djpeg
/usr/local/bin/jpegtran
/usr/local/Cellar/jpeg
/usr/local/Cellar/jpeg/8d/bin/cjpeg
/usr/local/Cellar/jpeg/8d/bin/djpeg
/usr/local/Cellar/jpeg/8d/bin/jpegtran
/usr/local/Cellar/jpeg/8d/include/jpeglib.h
/usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib
/usr/local/Cellar/jpeg/8d/lib/libjpeg.a
/usr/local/Cellar/jpeg/8d/lib/libjpeg.dylib
/usr/local/Cellar/jpeg/8d/share/man/man1/cjpeg.1
/usr/local/Cellar/jpeg/8d/share/man/man1/djpeg.1
/usr/local/Cellar/jpeg/8d/share/man/man1/jpegtran.1
/usr/local/include/jpeglib.h
/usr/local/lib/libjpeg.8.dylib
/usr/local/lib/libjpeg.a
/usr/local/lib/libjpeg.dylib
/usr/local/Library/Aliases/libjpeg
/usr/local/Library/Aliases/libjpeg-turbo
/usr/local/Library/Formula/jpeg-archive.rb
/usr/local/Library/Formula/jpeg-turbo.rb
/usr/local/Library/Formula/jpeg.rb
/usr/local/Library/Formula/jpeginfo.rb
/usr/local/Library/Formula/jpegoptim.rb
/usr/local/Library/Formula/jpegrescan.rb
/usr/local/Library/Formula/mjpegtools.rb
/usr/local/Library/Formula/mozjpeg.rb
/usr/local/Library/Formula/openjpeg.rb
/usr/local/Library/Formula/recoverjpeg.rb
/usr/local/Library/LinkedKegs/jpeg
/usr/local/opt/jpeg
/usr/local/share/man/man1/cjpeg.1
/usr/local/share/man/man1/djpeg.1
/usr/local/share/man/man1/jpegtran.1
/usr/local/src/jpeg-9a
/usr/local/src/jpeg-9a/.deps/cdjpeg.Po
/usr/local/src/jpeg-9a/.deps/cjpeg.Po
/usr/local/src/jpeg-9a/.deps/djpeg.Po
/usr/local/src/jpeg-9a/.deps/jpegtran.Po
/usr/local/src/jpeg-9a/.libs/cjpeg
/usr/local/src/jpeg-9a/.libs/djpeg
/usr/local/src/jpeg-9a/.libs/jpegtran
/usr/local/src/jpeg-9a/.libs/libjpeg.9.dylib
/usr/local/src/jpeg-9a/.libs/libjpeg.a
/usr/local/src/jpeg-9a/.libs/libjpeg.dylib
/usr/local/src/jpeg-9a/.libs/libjpeg.la
/usr/local/src/jpeg-9a/.libs/libjpeg.lai
/usr/local/src/jpeg-9a/cdjpeg.c
/usr/local/src/jpeg-9a/cdjpeg.h
/usr/local/src/jpeg-9a/cdjpeg.o
/usr/local/src/jpeg-9a/cjpeg
/usr/local/src/jpeg-9a/cjpeg.1
/usr/local/src/jpeg-9a/cjpeg.c
/usr/local/src/jpeg-9a/cjpeg.o
/usr/local/src/jpeg-9a/djpeg
/usr/local/src/jpeg-9a/djpeg.1
/usr/local/src/jpeg-9a/djpeg.c
/usr/local/src/jpeg-9a/djpeg.o
/usr/local/src/jpeg-9a/jpegint.h
/usr/local/src/jpeg-9a/jpeglib.h
/usr/local/src/jpeg-9a/jpegtran
/usr/local/src/jpeg-9a/jpegtran.1
/usr/local/src/jpeg-9a/jpegtran.c
/usr/local/src/jpeg-9a/jpegtran.o
/usr/local/src/jpeg-9a/libjpeg.la
/usr/local/src/jpeg-9a/libjpeg.map
/usr/local/src/jpeg-9a/libjpeg.txt
/usr/local/src/jpeg-9a/makcjpeg.st
/usr/local/src/jpeg-9a/makdjpeg.st
/usr/local/src/jpeg-9a/makljpeg.st
/usr/local/src/jpeg-9a/maktjpeg.st
/usr/local/src/jpegsrc.v9a.tar.gz

1 个答案:

答案 0 :(得分:2)

好的,看起来你只需要:

  1. /usr/local/include添加到标题搜索路径(转动递归 关闭)。 This看起来仍然相关。
  2. 链接二进制文件reference)中明确链接/usr/local/lib/libjpeg.a。这将链接到静态库中,这意味着无需使用您的应用程序分发JPEG动态库。