Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:53:25+00:00 2026-06-11T11:53:25+00:00

I am new to C++ on linux enviroment and am trying to use the

  • 0

I am new to C++ on linux enviroment and am trying to use the png++ library for a project. The problem I am facing is that that a simple program I write using png++ incudes does not work and shows me the following errors

AProg.o: In function `png::info_base::info_base(png::io_base&, png_struct_def*)':
AProg.cpp:(.text._ZN3png9info_baseC2ERNS_7io_baseEP14png_struct_def[_ZN3png9info_baseC5ERNS_7io_baseEP14png_struct_def]+0x21): undefined reference to `png_create_info_struct'
AProg.o: In function `png::info::write() const':
AProg.cpp:(.text._ZNK3png4info5writeEv[png::info::write() const]+0xd4): undefined reference to `png_set_PLTE'
AProg.cpp:(.text._ZNK3png4info5writeEv[png::info::write() const]+0x137): undefined reference to `png_set_tRNS'
AProg.cpp:(.text._ZNK3png4info5writeEv[png::info::write() const]+0x14f): undefined reference to `png_write_info'
AProg.o: In function `png::info::sync_ihdr() const':
AProg.cpp:(.text._ZNK3png4info9sync_ihdrEv[png::info::sync_ihdr() const]+0x79): undefined reference to `png_set_IHDR'
AProg.o: In function `png::end_info::destroy()':
AProg.cpp:(.text._ZN3png8end_info7destroyEv[png::end_info::destroy()]+0x48): undefined reference to `png_destroy_info_struct'
AProg.o: In function `png::end_info::write() const':
AProg.cpp:(.text._ZNK3png8end_info5writeEv[png::end_info::write() const]+0x1a): undefined reference to `png_write_end'
AProg.o: In function `png::io_base::set_swap() const':
AProg.cpp:(.text._ZNK3png7io_base8set_swapEv[png::io_base::set_swap() const]+0x1b): undefined reference to `png_set_swap'
.............. (and it goes on).

The background of what I have done so far.

1 : I have gcc/g++ configured correctly.

2 : I have correctly installed libpng-1.2.50. The result seems to be correct.

This is how my usr/local folder looks now

:/usr/local/include$ ls

libpng12  libpng15  png++  pngconf.h  png.h  pnglibconf.h

:/usr/local/lib$ ls

libpng12.a   libpng12.so    libpng12.so.0.50.0  libpng15.la  libpng15.so.15     libpng.a   libpng.so    libpng.so.3.50.0  python2.7
libpng12.la  libpng12.so.0  libpng15.a          libpng15.so  libpng15.so.15.12.0  libpng.la  libpng.so.3  pkgconfig

:/usr/local/bin$ ls

eclipse  libpng-1.2.50  libpng12-config  libpng-1.5.12  libpng15-config  libpng-config  png++-0.2.5

3 : After that I followed the following ( http://www.nongnu.org/pngpp/doc/0.2.5/ ) to install the png++-0.2.5 and all the five steps didnt gave any error.

But after that when I tried to compile a simple program (with the instructions given at the same site : http://www.nongnu.org/pngpp/doc/0.2.5/ ) it would not compile.

:~/workspace/AProg$ g++ -o AProg AProg.o 'libpng-config --ldflags'

g++: error: libpng-config --ldflags: No such file or directory

Then I tried to solve the problem and google it and gave this command which seems to work fine at compile but when I tried to run it. I got the error as mentioned at the top of the post

 :~/workspace/AProg$ g++ -c AProg.cpp -I/usr/local/include/libpng12 -L/usr/local/lib -lpng -I/usr/local/include/png++

 :~/workspace/AProg$ 

I am sorry for such a long post. But I just wanted to explain anything /everything related to my problem. Hope somebody helps me here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:53:26+00:00Added an answer on June 11, 2026 at 11:53 am

    It seems that the quotes you use in the linker command line is not the correct ones, it should be the single back quote:

    $ g++ -o AProg AProg.o `libpng-config --ldflags`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Linux and I am trying to compile some code that
I am trying to implement some kind of new Linux task scheduler so I
I'm very new to Linux and programming on Linux. I'm trying to install OpenAL
I'm new to Linux/CentOS and I'm not having the most fun using it. I
I am trying to build a script (I'm pretty new to linux scripting) and
I'm new to Linux and especially to Ubuntu 11 which I'm just trying today
I can understand how one can write a program that uses multiple processes or
I am relatively new to linux and am trying to install the pygame dev
I'm pretty new to programming for Linux environments, so I don't exactly know what
I am rather new to Linux device driver programmring, but for debugging purposes, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.