β¦ π 2 min, π 4 min
build system
Cmake works and have all building blocks in place to start using one of the most powerful editors for C++
: The CLion, brought to you by the team at JetBrains. (For the record they don't pay me to advertise their editors. I just really like them π). CLion is a C++
interactive development environment (IDE) created by JetBrains that's so smart it will teach you how to write better more, readable code. It can even catch any redundant object copies and so much more.JetBrains has other editors for pretty much every possible language out there, and all of them are insanely powerful.One big issue of CLion
is that it works only with C++
projects with existing cmake
files. If the project is small, you can write the cmake
files pretty quickly and get access to a powerful toolchain with minimal effort. If the project is large and uses another build system, that could be a deal-breaker.CLion
has no free community edition as PyCharm
does. If you're a student or an academic, you can also get the professional licence for free.Get the version of the software here .Or install CLion
with a package manager on macOS:brew install clion
Find the app and start it up:You'll be greeted with the following prompt:CLion
?CLion
?New project
option:Fill out the project's location and the C++
standard that you want to use. Or you can import/open an existing project from your disk. I prefer to start project structure through the command line using mkdir
, touch
, ... and then just open the project in CLion
. For some reason, I find it more manageable.Although if you're using the editor for the first time, create a new project with CLion
directly to get the feeling for the editor. C++
program in CLion
?CLion
will use cmake
to build and compile your program:Then it will run the executable in the second step:The extremely nice part with CLion
is that you can execute:mkdir build
cd build
cmake ..
make
With a press of one button every time you need to rebuild your codebase. So helpful when you want to focus on some wired memory management.In the above example, the IDE configured the build process
and executable to run for us, but sometimes we have an existing project.vim
mode. Customisation is not as easy and versatile like in the command line, but it's really powerful.cmake
CLion
uses cmake
but creates a custom folder where it places all the files generated during the compile process. Those files are placed into cmake-build-debug
folder instead of the build
one we used in the command line compile process ( How build system
Cmake works? ). cmake-build-debug
has the following content:You should know where those files are and that you can omit them from the version control, but don't dig into this stuff unless you know what you're doing. Use cmake
as a black box as long as you can afford. Then maybe once you master C++
enough you'll want to dig into the anatomy of the build system.CLion
that it doesn't make sense to cover them here. But in general, the tool can do a lot. If you write C++
daily, use it and never look back.
Get notified & read regularly π