Sign in to follow this  

C++ Image Library: CImg + libpng

This topic is 2667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been using CImg for my image-handling, but I'd like to add support for PNGs. CImg doesn't provide this feature natively, so I'm trying to use libpng and zlib in my VS2010 project to allow the loading and saving of PNG image files. I've added all of the source files, libraries, and variable definitions to allow CImg to communicate with libpng, but I'm getting tons of "unresolved external" errors.

I believe I've added all the necessary paths to my solution properties. If anyone can help, I'd be appreciative. I've spent two full days trying to solve this.

I get 18 unresolved externals, one of which is pasted below:

Error 15 error LNK2019: unresolved external symbol _png_destroy_read_struct referenced in function "public: struct cimg_library::CImg<float> & __thiscall cimg_library::CImg<float>::_load_png(struct _iobuf * const,char const * const)" (?_load_png@?$CImg@M@cimg_library@@QAEAAU12@QAU_iobuf@@QBD@Z) C:\_Code\CPP\_ImageCreator\libpngtest\libpngtest\libpngtest.obj

Share this post


Link to post
Share on other sites
If you want to use a C src inside your C++ project
you should (if it's not completely a C++ compatible )notify your compiler by wrapping the C code with extern "C"{}.

Check out this link:

http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html

Share this post


Link to post
Share on other sites
CImg has the extern C definitions already in it. I can't tell if I'm missing a library or header, though, since it doesn't have the best documentation.

Share this post


Link to post
Share on other sites

This topic is 2667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this