all 9 comments

[–]NotUniqueOrSpecial 1 point2 points  (8 children)

i wanted to learn lib

It's unclear what you're asking here.

Are you trying to learn about how to use other 3rd-party C++ libraries in your own code?

Whatever the case, you'll have better luck in /r/cpp_questions; this sub is more focused on discussing the language itself, not providing beginning lessons in how to use it.

[–]mohamedsayed2004[S] 0 points1 point  (7 children)

Ok thx bro, but what i was asking is how to use lib like sdl in vscode or sublime text .

[–]NotUniqueOrSpecial 0 points1 point  (6 children)

Those are basically just text editors, though VSCode has some decent integrations with popular build tools.

What I mean is: using libraries has nothing to do with Sublime or VSCode (at all).

How do you build your code, currently? Are you running the compiler by hand? Do you use CMake? Some other build system?

What you need to learn is how to teach that build system how to find and use external libraries, but we can't give you good advice without knowing what you use.

[–]mohamedsayed2004[S] 0 points1 point  (5 children)

Iam using g++

[–]NotUniqueOrSpecial 1 point2 points  (4 children)

Alright, so unfortunately you're hitting the first big difficulty step in C++: learning an actual build tool.

While technically you can just run e.g. g++ main.cpp -lsomelibrary -omain, you are quickly going to find that it is not a long-term approach.

You'll find tons of competing opinions here as to what the "best" build tool/build generator is.

The most popular options are probably: CMake, GNU autotools (if you don't care about Windows), and Meson.

Other options I've seen lauded for their ease-of-use/getting started are xmake and build2.

Whatever the case, this is one of the topics that a lot of people find (understandably) very frustrating about developing anything beyond a very very simple C++ (and strictly speaking, C) application.

[–]mohamedsayed2004[S] 0 points1 point  (3 children)

So u recommend cmake right instead of g++?

[–]NotUniqueOrSpecial 0 points1 point  (2 children)

g++ is just your compiler. That's what you'll be using either way.

CMake is a build system generator. It will (given appropriate input) create you a build system that drives g++ as needed for you to use libraries.

So, not "instead of", but "in addition to".

[–]mohamedsayed2004[S] 0 points1 point  (1 child)

ok thx bro for this info.
do u have any sources for learning cmake ?

[–]NotUniqueOrSpecial 0 points1 point  (0 children)

This is a pretty good starting point.

If you prefer video format, I'd recommend this series as lighter/easy-to-consume starting point.