Modern C++ for C Programmers
ds9a.nl
ds9a.nl
But the biggest thing that I struggled with (and still have no idea about) when learning C++ was trying to learn how to build real projects. This includes things like, how do you use an external library? How do you set up a build system? Which build system to use in the first place? The last time I was trying to learn C++ (about two years ago I think?) I couldn't find answers to these questions, which was pretty discouraging as I thought C++ was a really useful language to learn. I wish this article covered some of these topics for beginners looking to build something more than a simple program.
How to incorporate external libraries depends on if they're header-only, shared libraries, or static libraries (do people still use static libraries?). pkg-config is your friend!
Plus unless you are doing plugins, dynamic linking is an attack vector.
On Apple, Windows, embedded platforms and game consoles, it is pretty much "File->New Project" on the respective OS IDEs.
Then you just vendor the libraries on some company wide repository and use the IDE respective features to link to them.
Then most CI/CD systems understand the respective project files.
Naturally you can also go old style Makefiles, CMake or whatever is the build tool of the day.
It depends on the company's approach to their development stack.
Are you using Linux or Windows? If Windows & MS Visual Studio, Yan Cherinokov (programmer at EA) made some helpful videos about how to create libraries and link them:
https://www.youtube.com/user/TheChernoProject/search?query=l...
I recommend his C++ tutorials over other ones because he often deliberately does the wrong thing to show you what the error messages look like. This teaches you how to troubleshoot your own C++ projects when you encounter the same errors.
Lots of tutorials only show the correct way but it's also important to demonstrate the common ways that beginners do it incorrectly. This teaches people how to dissect the error codes.
clang++ does have good c++17 support but g++ only supports full set of c++14
- C++ has hundreds of dialects to pick from. You'll spend time bikeshedding with coding standards, you'll spend time in meetings trying to get people to agree to a standard, you'll spend time trying to enforce the standard...
- Rust makes reasonable decisions by default, and mutable/unsafe code is opt-in.
Personally the thing that really sold me over was the "Building a guessing game" section, as it showed how to use the build system to pull in external libraries. I found these aspects specifically difficult to learn when learning C++. Plus, after learning Rust, I was able to go back to C++ and better understand it. Still have no clue about build systems though.