undefined reference to `png_create_write_struct'问题解决

转载地址:http://www.linuxidc.com/Linux/2014-02/97344.htm

由于系统原因,今天要重新编译QT,在编译PC版的qvfb的make步骤时,出现了如下错误:

.obj/release-shared/qanimationwriter.o: In function `QAnimationWriter::QAnimationWriter(QString const&, char const*)':
qanimationwriter.cpp:(.text+0xbf): undefined reference to `png_create_write_struct'
qanimationwriter.cpp:(.text+0xca): undefined reference to `png_create_info_struct'
qanimationwriter.cpp:(.text+0xe0): undefined reference to `png_set_compression_level'
qanimationwriter.cpp:(.text+0xff): undefined reference to `png_set_write_fn'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::write(png_struct_def*, unsigned char*, unsigned int)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG5writeEP14png_struct_defPhj[QAnimationWriterMNG::write(png_struct_def*, unsigned char*, unsigned int)]+0xb): undefined reference to `png_get_io_ptr'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x65): undefined reference to `png_write_chunk'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x78): undefined reference to `png_set_sig_bytes'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0xda): undefined reference to `png_set_IHDR'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0xec): undefined reference to `png_write_info'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x107): undefined reference to `png_set_bgr'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x154): undefined reference to `png_write_image'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x172): undefined reference to `png_write_end'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x184): undefined reference to `png_destroy_write_struct'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x1a8): undefined reference to `png_create_write_struct'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x1b3): undefined reference to `png_create_info_struct'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x1c9): undefined reference to `png_set_compression_level'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x1e8): undefined reference to `png_set_write_fn'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)]+0x21f): undefined reference to `png_set_filler'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::~QAnimationWriterMNG()':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD0Ev[_ZN19QAnimationWriterMNGD5Ev]+0x9e): undefined reference to `png_write_chunk'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD0Ev[_ZN19QAnimationWriterMNGD5Ev]+0xb0): undefined reference to `png_destroy_write_struct'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD0Ev[_ZN19QAnimationWriterMNGD5Ev]+0x176): undefined reference to `png_write_chunk'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::setImage(QImage const&)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG8setImageERK6QImage[QAnimationWriterMNG::setImage(QImage const&)]+0xc3): undefined reference to `png_write_chunk'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::~QAnimationWriterMNG()':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD2Ev[_ZN19QAnimationWriterMNGD5Ev]+0x9e): undefined reference to `png_write_chunk'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD2Ev[_ZN19QAnimationWriterMNGD5Ev]+0xb0): undefined reference to `png_destroy_write_struct'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD2Ev[_ZN19QAnimationWriterMNGD5Ev]+0x16e): undefined reference to `png_write_chunk'
collect2: ld 返回 1
make: *** [../../bin/qvfb] 错误 1

截图如下:

解决办法:

第一步:#locate libpng

我的电脑显示如下:

/lib/i386-linux-gnu/libpng12.so.0
/lib/i386-linux-gnu/libpng12.so.0.46.0
/usr/share/doc/libpng12-0
/usr/share/doc/libpng12-0/ANNOUNCE
/usr/share/doc/libpng12-0/KNOWNBUG
/usr/share/doc/libpng12-0/README.Debian
/usr/share/doc/libpng12-0/README.gz
/usr/share/doc/libpng12-0/TODO
/usr/share/doc/libpng12-0/changelog.Debian.gz
/usr/share/doc/libpng12-0/copyright
/usr/share/doc/libpng12-0/libpng-1.2.46.txt.gz
/usr/share/doc-base/libpng12
/var/lib/doc-base/documents/libpng12
/var/lib/dpkg/info/libpng12-0:i386.list
/var/lib/dpkg/info/libpng12-0:i386.md5sums
/var/lib/dpkg/info/libpng12-0:i386.postinst
/var/lib/dpkg/info/libpng12-0:i386.postrm
/var/lib/dpkg/info/libpng12-0:i386.shlibs

第二步:建立链接#ln -s /lib/i386-linux-gnu/libpng12.so.0 /lib/i386-linux-gnu/libpng.so

第三步:修改Makefile文件,#gedit Makefile(或者 #vi Makefile),在LIBS后面添加-L/lib/i386-linux-gnu -lpng这两项

重新make后,成功!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值