我主要在Windows上工作,所以我不太熟悉Linux下不太常见的问题。
这是dub尝试链接我的应用程序时出现的错误:
/usr/bin/ld: .dub/obj/pixelperfectengine_pixelperfecteditor.o: undefined reference to symbol 'inflateEnd'
//lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1
/usr/bin/ldc2 failed with exit code 1.
我有一个图像处理库作为依赖项,这是应用程序所必需的,并且(显然)它使用zlib进行* .png压缩/解压缩。我已经为Ubuntu安装了zlib1g-dev,但没有解决我的问题,并且在Windows下可以编译相同的代码而没有任何问题。
/lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line
此错误告诉您必须将-lz
添加到命令行。我不知道dub
是什么,但是您必须以某种方式说服它才能将-lz
添加到它构造的链接命令中。]
在复制文件的-lz
中添加lflags可能就足够了。
如上所述,您需要链接到zlib
。