Xcode 上的 CImg 和 libtiff 的链接器错误

Linker errors with CImg and libtiff on Xcode

本文关键字:链接 错误 libtiff 上的 CImg Xcode      更新时间:2023-10-16

我无法让 libtiff 成功链接到使用 CImg 的应用程序。

我已经用brew安装了libtiff,什么都没有,从源代码编译libtiff并且仍然没有安装任何东西(顺便说一句,编译后的libtiff.a在哪里?我已经在 XCode 中添加了路径,但仍然无法链接它。在其他链接器标志中:/usr/local/lib/libtiff.a,但仍然没有。我得到很多:

 "_jpeg_read_header", referenced from:
      _TIFFjpeg_read_header in libtiff.a(tif_jpeg.o)
      _jpeg_read_header_encap in libtiff.a(tif_ojpeg.o)
  "_jpeg_has_multiple_scans", referenced from:
      _TIFFjpeg_has_multiple_scans in libtiff.a(tif_jpeg.o)
  "_jpeg_std_error", referenced from:
      _TIFFjpeg_create_decompress in libtiff.a(tif_jpeg.o)
      _TIFFjpeg_create_compress in libtiff.a(tif_jpeg.o)
      _OJPEGPreDecode in libtiff.a(tif_ojpeg.o)
  "_deflateParams", referenced from:
      _PixarLogVSetField in libtiff.a(tif_pixarlog.o)
      _ZIPVSetField in libtiff.a(tif_zip.o)
  "_jpeg_start_compress", referenced from:
      _TIFFjpeg_start_compress in libtiff.a(tif_jpeg.o)
  "_jpeg_CreateDecompress", referenced from:
      _TIFFjpeg_create_decompress in libtiff.a(tif_jpeg.o)
      _jpeg_create_decompress_encap in libtiff.a(tif_ojpeg.o)
  "_deflateEnd", referenced from:
      _PixarLogCleanup in libtiff.a(tif_pixarlog.o)
      _ZIPSetupDecode in libtiff.a(tif_zip.o)
      _ZIPCleanup in libtiff.a(tif_zip.o)
  "_jpeg_abort", referenced from:
      _TIFFjpeg_error_exit in libtiff.a(tif_jpeg.o)
      _TIFFjpeg_abort in libtiff.a(tif_jpeg.o)
      _TIFFjpeg_progress_monitor in libtiff.a(tif_jpeg.o)
  "_jpeg_resync_to_restart", referenced from:
      _TIFFJPEGIsFullStripRequired in libtiff.a(tif_jpeg.o)
      _JPEGSetupDecode in libtiff.a(tif_jpeg.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
好的,

我已经解决了。我不得不再次执行所有过程:下载libtiff,使用CMake为我的系统生成适当的配置文件(unix makefiles),然后从那里,只需控制台制作和安装,它们已正确安装在我的系统中,因此Xcode最终可以看到它们。我猜CMake是这里的英雄,因为./Configure以前没用。