I can write small Arduino programs, but I want to fill in my fundamentals and learn C++ more systematically. I’m also planning to switch to Linux. What free resources, compiler, and editor would be good to start with, and which topics should I tackle first?
What should I use to learn C++ on Linux?
Answers
LearnCpp is a free, structured tutorial and a good fit if you already have some coding experience. Go through it in order, skim the bits you know, and do the exercises rather than just reading.
Start with types, control flow, functions, and scope. Then work through references, pointers, object lifetimes, and memory management. Those ideas will help beyond C++ too.
Reply to this answer
For Linux, either g++ from GCC or clang++ is fine. Use your distribution’s package manager to install one, then try compiling a small program from the terminal before adding an IDE.
While learning, try the flags -Wall -Wextra -g -fsanitize=address,undefined when compiling and linking. The warning flags catch suspicious code, the debug flag adds debugging information, and the sanitizers can catch some memory errors and undefined behavior when the program runs. They won’t catch every problem, but they give you useful clues.
Nuvzelo-3d:
VS Code with clangd or the C/C++ extension is one option if you want editor assistance alongside the compiler.
Reply to this answer
Keep the editor choice simple. If you already like an editor, use it and spend your time writing code instead of configuring plugins. Code::Blocks is another free, relatively lightweight option if you want an IDE.
Reply to this answer
If you prefer a book over a website, look at Programming: Principles and Practice Using C++. The Deitel C++ books are another option with a learn-by-doing style. Check whether a library has either before buying, and pay attention to which C++ version the edition teaches.
Reply to this answer
CLion is worth a look if you want a full-featured IDE rather than assembling editor extensions. It’s available on Linux and free for non-commercial use. You’ll still need a compiler, though, so don’t skip learning the basics of how your code is built.
Reply to this answer
Add your answer
Answers are reviewed before publication.
_y56~drivnelo.8:
That sounds like a good way to find the gaps without starting completely from scratch. Thanks!