问题描述
我一直在试图运行使用tiffutils处理TIFF图像code。我遇到了架构x86_64的,一个已经多次来这里好老未定义的符号然而,没有任何线程对解决我的问题有帮助的描述的错误如下:
I have been trying to run a code that uses tiffutils to handle TIFF images. I am encountering the good old "Undefined symbols for architecture x86_64, that has already come up multiple times here. However, none of the threads were helpful in solving my issue. The errors are described as follows:
Undefined symbols for architecture x86_64:
"_TIFFClose", referenced from:
_GetImageFromTiff in tiffutils.o
_WriteImageToTiff in tiffutils.o
"_TIFFGetField", referenced from:
_GetImageFromTiff in tiffutils.o
"_TIFFOpen", referenced from:
_GetImageFromTiff in tiffutils.o
_WriteImageToTiff in tiffutils.o
"_TIFFReadScanline", referenced from:
_GetImageFromTiff in tiffutils.o
"_TIFFScanlineSize", referenced from:
_GetImageFromTiff in tiffutils.o
"_TIFFSetField", referenced from:
_WriteImageToTiff in tiffutils.o
"_TIFFWriteScanline", referenced from:
_WriteImageToTiff in tiffutils.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
在很多尝试,不知道寻求解决在互联网上,我意识到这个问题必须是X code是无法检测到TIFF库。编译器似乎抱怨在TIFF库无法识别一些非常核心功能。我不明白它是如何可能的,虽然,因为我没有要确保它被安装,而我包括X上code版本设定的的libtiff库。
After many attempts and wondering on the internet seeking a solution, I realized that the problem must be that Xcode is unable to detect the tiff library. The compiler seems to complain about not recognizing some very core functions in the tiff library. I don't understand how it is possible though, since I did make sure it was installed and that I include the libtiff library on Xcode's Build Setting.
我不知道该怎么办,所以我希望你们能帮助我在这里还有什么。有什么建议?
I don't know what else to do so I was hoping you guys could help me out here. Any suggestions?
**可能会有所帮助的更多信息(如果我需要这一切不知道,这个项目是写很久以前在Linux上,我试图编译它在Mac OS):
**More information that may be helpful (not sure if I need it all, this project was written ages ago on Linux, and I am trying to compile it on Mac OS):
(1)我的libtiff库位于:USR /本地/的libtiff-4.0.6
(2)我说这要我的目标,然后构建设置 - >库搜索路径,然后点击右侧栏并添加库USR /本地/的libtiff-4.0.6它。
(3)我的项目的Makefile看起来像这样:
(1) My libtiff library is located under: usr/local/libtiff-4.0.6(2) I added it going to my target then Build Setting --> Library Search Paths, then clicked on the right column and added the library usr/local/libtiff-4.0.6 to it.(3) My project Makefile looks like this:
# Makefile for creating shape-texture spaces
TIFFUTILS_DIR = ../../tiffutils
CC = gcc
CPPFLAGS= -O3 -m32 -I$(TIFFUTILS_DIR) -I/usr/include -Wall
LDFLAGS = -m32 -L$(TIFFUTILS_DIR)/bin -L/usr/lib
LOADLIBES = -ltiffutils -ltiff
vpath %.c ..
SRC2_C = bimgalloc.c bimgio.c btof.c btol.c btos.c canny2.c \
die.c fileutils.c filtsub.c fimgalloc.c fimgio.c freflect.c \
ftob.c ftol.c ftos.c imgalloc.c limgalloc.c limgio.c ltob.c \
ltof.c ltos.c nint.c simgalloc.c simgio.c stob.c stof.c stol.c \
timgio.c
SRC2_O = $(SRC2_C:.c=.o)
canny2: $(SRC2_O)
SRC_C = bimgalloc.c bimgio.c btof.c btol.c btos.c canny.c \
die.c fileutils.c filtsub.c fimgalloc.c fimgio.c freflect.c \
ftob.c ftol.c ftos.c imgalloc.c limgalloc.c limgio.c ltob.c \
ltof.c ltos.c nint.c simgalloc.c simgio.c stob.c stof.c stol.c \
timgio.c
SRC_O = $(SRC_C:.c=.o)
canny: $(SRC_O)
clean:
rm *.o canny canny2
#
# EOF
#
(4)我也有一个tiffutils Makefile文件,看起来像这样:
(4) I also have a tiffutils Makefile that looks like this:
LIB = libtiffutils.a
CC = gcc
ARFLAGS = ursv
CPPFLAGS= -I.. -Wall -O3 -m32
vpath %.c ..
LIB_TIFFUTILS_C = tiffutils.c
LIB_TIFFUTILS_O = $(LIB_TIFFUTILS_C:.c=.o)
all: libtiffutils
libtiffutils: $(LIB_TIFFUTILS_O)
$(AR) $(ARFLAGS) $(LIB) $(LIB_TIFFUTILS_O)
clean:
rm $(LIB) $(LIB_TIFFUTILS_O)
感谢您阅读!
推荐答案
其中项目位于计算机上?
where is your project located on your computer?
我希望它位于:
/home/<username>/<projectname>
和你说,tiffutils位于:
and you have stated that the tiffutils is located at:
/usr/local/libtiff-4.0.6/tiffutils
在Makefile中的相对路径说(顺便说一句:为什么一个相对路径)
The relative path in the makefile says (BTW: why a relative path?)
(其分解一步一步来。)
(breaking it down step by step.)
/home/<username> leaves ../tiffutils/libtiffutils.
/home/tiffutils/libtiffutils.
这是绝对不一样的:
/usr/local/libtiff-4.0.6/tiffutils/libtiffutils.
于是路径库需要是绝对路径,看起来像:
So the path to the library needs to be an absolute path that looks like:
/usr/local/libtiff-4.0.6/tiffutils
这篇关于X code不认识TIFF功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!