Compile, Build and Run C++
You need to have a dir with your .cpp files and the CMakeLists.txt file.
Here you can see an example of these types of directories:
Then, in this same directory, you need to create a build folder, then compile (using the CMakeLists.txt file information), then building the executable file and then launch the (just created) executable file:
$ mkdir -p build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ make name_of_file
$ ./name_of_file
You just need this to run the recently created file. Every time you change the .cpp original file, you should run the last 3 command lines in order to test that changes when running the program.
The build folder should contain the following:
Comments
Post a Comment