I’ve been trying to learn a system language because it would enable me to access a whole new world of possibility for games, tools, and potential projects. My main problem when learning the language are:

  • can I write modern C++ code using the newer standards and still compile with libraries from older standards?
  • how do I even organize a C++ project? Look at the linked project, the CMakeList.txt is so hard to understand, the syntax looks so hard to write.
  • how do I install dependencies? You’re going to laugh at me, but I always used languages with package managers and I looked again at the linked project, and they write a whole CMakeList.txt to import ImGui (GUI library I wanna try) but if you compare the structure of the files, it’s different from the ones on the repository of ImGui.

As you see there are a lot of problems and it pains me to not be able to solve them because Rust is so unfun to use and work with! Do you think I should try C++, carry one with it?

Thanks, hector.

  • Dark ArcA
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    8 months ago

    C++ is a great language. However, the standard library is small and the systems for package management are vastly inferior to what you find with other popular languages.

    C++ applications regularly use largely organization internal code bases with bits and pieces of the standard library integrated into them.

    That’s so as to say, with C++ code tends to be more freestanding/independent but it also means that the time from no code to “working” for non-toy projects is way higher than it otherwise should be (e.g. if you could just trivially pull in a few good libraries).

    can I write modern C++ code using the newer standards and still compile with libraries from older standards?

    The answer as to “can you take C++11 code and mix it with C++20 code” (as an example) is a more complicated one. I suggest this excellent answer from Jonathan Wakely which is relevant to the GNU/GCC C++ implementation https://stackoverflow.com/a/49119902

    how do I even organize a C++ project?

    This is something I struggled with when I first came to C++ land and the answer is basically “however the heck you want.”

    Every C++ project takes a different approach. C++ build systems are closer to bash script anarchy than some carefully crafted standard practice.

    If you go into C++ build systems expecting well established, consistent, conventions… You’re going to be disappointed and frustrated.

    The C++ ecosystem in general provides options more than answers. This is in contrast to something like Ruby on Rails where convention over configuration is the mantra.

    Do you think I should try C++, carry one with it?

    If you’re interested, absolutely! You do need to temper your expectations with C++ though. It’s a great language once your code base has some momentum, prior to that point though you’re going to have to be scrappy.

    I’d recommend trying to either expand on an existing project or working within an established ecosystem that does have some guiding principles. Qt, CryEngine, Godot, Boost, CMake, and Meson are all terms I would Google and consider looking at to varying degrees. There’s also cool stuff to look at here: https://en.cppreference.com/w/cpp/links/libs