在D应用程序中的Linux下链接到zlib时如何解决此错误?

问题描述 投票:0回答:3

我主要在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下可以编译相同的代码而没有任何问题。

linux ubuntu linker dependencies d
3个回答
0
投票

/lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line

此错误告诉您必须将-lz添加到命令行。我不知道dub是什么,但是您必须以某种方式说服它才能将-lz添加到它构造的链接命令中。]


0
投票

在复制文件的-lz中添加lflags可能就足够了。


0
投票

如上所述,您需要链接到zlib

© www.soinside.com 2019 - 2024. All rights reserved.