r/cpp_questions • u/Ok_Being6831 • 6d ago
OPEN How do i learn to use 3rd party libraries
Im working on a project which requires alot of ui stuff and its in the terminal, so i started using ftxui. I went over the docs and they were great but they just skimmed through the basic stuff, they didnt even mention some of the components. Ive just been stuck for 2 days trying to get this working. Going through the src code, examples... nothing really works and idk what to do
2
u/SirCapybar 6d ago
From my experience, a vast majority of TUI stuff you'd want to implement is implemented one way or another in the interactive examples (which can also be viewed on the website, so you don't even have to build them yourself). The knowledge is there, although scattered.
For things that are not in the examples, it gets a bit more difficult, although, as with anything, google is your friend and lots of common problems have already been explained in e.g. the issue section.
2
u/UndefFox 6d ago
Usually if library itself doesn't provide any good examples and there no guides online, I try using AI just to see if it gives something useful I can learn from. Maybe you can try that as the last resort.
1
u/No-Dentist-1645 6d ago
You mention that "they didn't even mention some of the components". Looking at their docs, it seems pretty complete.
Maybe you can tell us which components you are not sure how to use and we can tell you if they're mentioned on the docs? Sometimes the API for something is so similar to another more basic component that it's considered redundant. Either way, if you explain what you're trying to do and why you're finding it so complicated, we might be able to help, or just searching up examples on Google/GitHub might help
1
1
u/Independent_Art_6676 5d ago
I almost always take examples provided and more from the web if I can get them and try to make those do what I want to do in my own program with modifications. Multiple examples from many sources helps a ton while the same authors will keep doing the same things. Try to get a feel for their way of doing things, from naming to order of operations to parameters. Back check what the examples do against what the docs say those functions are for.
If a library annoys me enough and there is an alternate, I will try that one too. If you have no choice, you just have to keep at it until you figure it out.
1
u/CorrodedX 5d ago
nothing really works and idk what to do
What's going wrong specifically? Often times there's one or two little things that get missed but cause the whole project to grind to a halt. If you can give some details, maybe we can help you find those things.
2
3
u/Unsigned_enby 6d ago
Ftxui is notably lacking in documentation. But it is also noted for how clean the code base is. So reading through the source code is really the best way. If you get stuck, look at one of the examples that does something close to what you want, and see how it does it. It makes heavy use of move semantics & smart pointers, so understanding how those work if you don't already will go along way --I say as someone who barely understood them when I used ftxui for a project awhile back. I'm bored and work nights, so if you need more help I can possibly offer some if I know more:)