2

Here is link for png++ :http://savannah.nongnu.org/projects/pngpp/

What I'm doing wrong? I installed opencv for OS X by command in terminal:"brew install opencv" and I have problems with using library png++.

#include <iostream>
#include "png++/png.hpp"

using namespace std;
int main(int argc, const char * argv[]) 
{
  png::image< png::rgb_pixel > image("74");
  for(int i=0;i<image.get_width();i++)
  {
    for(int j=0;j<image.get_height();j++)
    {
        image[i][j]=png::rgb_pixel(255-image[i][j].red, 255-image[i][j].green, 255-image[i][j].blue);
    }
}
image.write("output.png");
return 0;
}

And I have next errors:

error messages

John
  • 53
  • 6
  • from the errors it seems like you are missing some linking flags, can you post the command you use to compile? Edit: very possibly it is the same problem as in http://stackoverflow.com/questions/9351777/linker-error-with-libpng-under-macosx – bznein Oct 20 '15 at 14:39
  • I don't know, how Xcode build the projects, I press the button start – John Oct 20 '15 at 14:52
  • But when I tried to compile from terminal with command: "g++ -ggdb `pkg-config --cflags --libs opencv` main.cpp", I see that error : "Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found In file included from main.cpp:10: ./png++/png.hpp:34:10: fatal error: 'png.h' file not found #include ^ 1 error generated." – John Oct 20 '15 at 15:02

1 Answers1

2

Problem was, that I install opencv with brew, which I installed on Yosemite. When I updated brew on ElCapitan and reinstalled opencv, errors disappeared.

John
  • 53
  • 6