PNG support?

Asked by Milian Wolff

It seems like PNG support is disabled for plotutils, even though it depends on libpng... I'm lost. I have libplot-dev installed, and examples which do not use PNGPlotter work properly. Take this example:
~~~~
     #include <plotter.h>
     using namespace std;
     int main ()
     {
       // works
       PSPlotter postcript(cin, cout, cerr);
       // fails
       PNGPlotter png(cin, cout, cerr);
       return 0;
     }
~~~~

Now try to compile it:

~~~~
g++ -lplotter -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lpng -lz -lm -ansi -Wall -pedantic test.cpp
test.cpp: In function »int main()«:
test.cpp:8: Fehler: »PNGPlotter« wurde in diesem Gültigkeitsbereich nicht definiert
test.cpp:8: Fehler: expected `;' before »png«
~~~~

I took the -l options from `info:/plotutils/C++ Compiling and Linking`. What am I doing wrong?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu plotutils Edit question
Assignee:
No assignee Edit question
Solved by:
Milian Wolff
Solved:
Last query:
Last reply:
Revision history for this message
Harvey Muller (hlmuller) said :
#1

Milian,

I barely know C. Still learning, so take my recommendation with a grain of salt. But if png is not defined, then it is likely that you are missing the png development headers.

I believe you can find them by searching synaptic for libpng.

Please return to Launchpad and mark this question Solved if this resolves your issue.

Danke,

Harvey

Revision history for this message
Milian Wolff (milianw) said :
#2

It's not C - it is C++. And I have libpng12-dev installed. I found a workaround:

~~~~
g++ -DINCLUDE_PNG_SUPPORT -lplotter -ansi -Wall -pedantic test.cpp
~~~~

That seems to work so far. But I'm not sure this is really required? It is not documented in info... I think this is either a bug _or_ we need to change the documentation. What do you think?

Revision history for this message
Harvey Muller (hlmuller) said :
#3

Milian, I know your code is C++, I was just remarking that I barely know C.

The manual does not indicate that it is necessary to use the macro on the command line, in the section you referenced. So yes, I would say it is a bug in the documentation.

Or maybe they just consider plotter.h part of the documentation?

Thanks!

Harvey

Revision history for this message
Harvey Muller (hlmuller) said :
#4

Milian,

I am checking to see if the information provided previously resolved your question. If so, please mark the question Solved.

Thanks!

Harvey

Revision history for this message
Milian Wolff (milianw) said :
#5

Yes, I think I'll report a bug for the documentation. Thank you Harvey!