r/cpp_questions • u/TeneSicarius • 2d ago
OPEN Help getting external libraries working
I'm decently inexperienced with C++ (Only did one class using the language during school, and we used std for everything). I'm not actually sure everything I need to do to get an external library working for my project.
I'm using CLion IDE, most of my settings are still untouched, and I'm trying to get CImg (with libpng) I researched the topic online, but I didn't quite figure out how to get it working... in part, because I'm not sure which part of libpng I'm supposed to use.
I usually prefer to recreate all my functions from scratch, but I couldn't really do that for images, especially if I wanted access to .png files. I'm not picky about using Cimg, I really just need something that can display, rotate, resize, and edit images together (like putting a character on a background).
I backed up my code to github, and made a public branch. If you wanna tear apart an amatuer's code, there's probably a lot to laugh at in here, but I might learn something from people pointing out all the mistakes.
https://github.com/Viteris/Jivelthresh
View all comments
3
u/alfps 1d ago edited 1d ago
Quoting the CImg web page
So for basic use that's all you have to do. Nothing to build.
The documentation is AFAICS silent on the issue of how to use
libpng.It does mention that if Image Magik is installed it can handle a number of image formats.
However the source code has a comment
I considered adding a flippant comment "Use the source, Luke!", but decided against it. For it's not the first you should do. At the risk of attracting moronic downvoters: the first you should do when you have such a problem and the documentation doesn't help, is to realize that others must have had the same problem and so Google will know, so just google it, which is what I did. The Google AI spit out
cimg_use_png, which I then tried to find in the documentation, using a site-limited search plus manual inspection of the documentation PDF. Then, when I didn't find it, I downloaded and looked at the source code as a last resort.