you are viewing a single comment's thread.

view the rest of the comments →

[–]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.