Jump to content
  • Advertisement
Sign in to follow this  
xikkub

C++ Image Library: CImg + libpng

This topic is 2976 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
Advertisement
Thanks for the reply. How would I go about fixing that? I don't know how these libraries work.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!