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
Show parent comment
1
u/TeneSicarius 1d ago edited 1d ago
I did have a separate folder labeled 'library' where I put Cimg. It was mostly trying to get libpng compatibility that I was stuck on. I read that part in the source code when I did a control+f in the file for png, and now I've just been trying to deal with the cluster-f that is libpng 79 files in the first tab. Compared to Cimg's 5. I'm not sure what I import to enable the cross compatibility. Or how to properly define cimg_use_png.
Edit: Is it really just #include "png.h"? And do I have to upload an entire copy of both libraries if I want to share a playable version? libpng was really confusing documentation-wise, and I don't feel confident compared to when I make a program from scratch...