标题:qvfb编译问题
作者:fq1110
日期:2013-02-01 11:14
内容:
QT4 linux下编译qvfb时,编译成功,但链接出错。
都是png相关函数png_create_write_struct .......。
png.h的文件存在。没有提示找不到png.h文件。
libpng-dev卸载与安装后测试都没作用。
4.8.4的版本,有人遇到过这问题吗?
#1 [fq1110 02-27 11:21]
In function `QAnimationWriter::QAnimationWriter(QString const&, char const*)':
qanimationwriter.cpp:(.text+0xa9c): undefined reference to `png_create_write_struct'
qanimationwriter.cpp:(.text+0xaa7): undefined reference to `png_create_info_struct'
qanimationwriter.cpp:(.text+0xabd): undefined reference to `png_set_compression_level'
qanimationwriter.cpp:(.text+0xadc): undefined reference to `png_set_write_fn'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriter::QAnimationWriter(QString const&, char const*)':
qanimationwriter.cpp:(.text+0xc1c): undefined reference to `png_create_write_struct'
qanimationwriter.cpp:(.text+0xc27): undefined reference to `png_create_info_struct'
qanimationwriter.cpp:(.text+0xc3d): undefined reference to `png_set_compression_level'
qanimationwriter.cpp:(.text+0xc5c): undefined reference to `png_set_write_fn'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::setImage(QImage const&)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG8setImageERK6QImage+0xb6): undefined reference to `png_write_chunk'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::write(png_struct_def*, unsigned char*, unsigned int)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG5writeEP14png_struct_defPhj+0xd): undefined reference to `png_get_io_ptr'
.obj/release-shared/qanimationwriter.o: In function `QAnimationWriterMNG::composeImage(QImage const&, QPoint const&)':
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint+0x4a): undefined reference to `png_write_chunk'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNG12composeImageERK6QImageRK6QPoint[QAnimationWriterMNG::composeImage(QIm ..
#2 [lishengwu 02-27 16:15]
我也碰到这个问题了,请问,解决了吗?
#3 [dragon_fly 03-05 10:06]
我试了下QT 4.8.5,也是这个问题,是不是缺少什么库,我用的redhat 6.5,是不是缺少lib
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD0Ev[_ZN19QAnimationWriterMNGD5Ev]+0x84): undefined reference to `png_write_chunk'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD0Ev[_ZN19QAnimationWriterMNGD5Ev]+0x91): undefined reference to `png_destroy_write_struct'
qanimationwriter.cpp:(.text._ZN19QAnimationWriterMNGD0Ev[_ZN19QAnimationWriterMNGD5Ev]+0x134): undefined reference to `png_write_chunk'
collect2: ld returned 1 exit status
#4 [dragon_fly 03-05 10:38]
解决办法:
ubuntu12.04 ,QT 4.8.5:
第一步:#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
..........
第二步:建立链接#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后,成功!
#5 [dragon_fly 03-05 10:43]
解决办法:
Redhat 6.5 x64 ,QT 4.8.5:
第一步:#locate libpng
电脑显示如下:
/usr/lib64/libpng.so.3
/usr/lib64/libpng.so.3.49.0
/usr/lib64/libpng12.so.0
/usr/lib64/libpng12.so.0.49.0
..........
第二步:建立链接# ln -s /usr/lib64/libpng12.so.0/usr/lib64/libpng.so
第三步:修改Makefile文件,#gedit Makefile(或者 #vi Makefile),在LIBS后面添加-L/usr/lib64 -lpng这两项
重新make后,成功!