Solve undefined reference to ' png_create_write_struct ' and so on

Source: Internet
Author: User


Operating system: Ubuntu12.04

QT Version: 4.8.5

I compile-time reference article: Http://hi.baidu.com/applesn/item/ce62411c18530cff86ad4e75

For system reasons, to recompile QT today, the following error occurred while compiling the PC version of the QVFB make step:

. 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&amp, Qpoint const&)]+0x65): Undefined reference to ' Png_write_chunk '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x78): Undefined reference to ' png_set_sig_bytes '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0xda): Undefined reference to ' PNG_SET_IHDR '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0xec): Undefined reference to ' Png_write_info '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x107): Undefined reference to ' PNG_SET_BGR '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x154): Undefined reference to ' png_write_image '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x172): Undefined reference to ' png_write_end '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x184): Undefined reference to ' png_destroy_write_struct '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x1a8): Undefined reference to ' png_create_write_struct '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x1b3): Undefined reference to ' png_create_info_struct '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x1c9): Undefined reference to ' png_set_compression_level '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, Qpoint const&)]+0x1e8): Undefined reference to ' PNG_SET_WRITE_FN '
Qanimationwriter.cpp: (. TEXT._ZN19QANIMATIONWRITERMNG12COMPOSEIMAGEERK6QIMAGERK6QPOINT[QANIMATIONWRITERMNG:: Composeimage (QImage const&amp, 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 return 1
Make: * * * * [...] /.. /BIN/QVFB] Error 1

Screenshot below:


Solution:

The first step: #locate libpng

My computer shows the following:

/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

Step Two: Establish link #ln-s/lib/i386-linux-gnu/libpng12.so.0/lib/i386-linux-gnu/libpng.so

Step three: Modify the Makefile file, #gedit Makefile (or #vi Makefile), add-l/lib/i386-linux-gnu-lpng after Libs

After the reset, success.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.