* Basic simplest way to compile a c++ file$ g++ file.cpp
This will generate an executable 'a.out' which we can execute to run the program
output of the program here.
* If we desire to have a specific name for the generated file we can do:
$ g++ file.cpp -o specificname.o
By running the command make, we can organize the compilation in a single file named Makefile. Makefiles are a simple way to organize code compilation.
Run make in the location where your Makefile is to compile and link everything.
If you want verbose output, you can type VERBOSE=1 make (helpful if something goes wrong).
--> A guide for doing Makefiles: http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
CMake is another way to compile the code specially if you need to link several libraries and the project start getting more complex. You just need to have a CMakeLists.txt file.
First, create a build folder and go inside the folder.
Inside your build directory, point cmake to the directory containing the CMakeLists.txt file.
$ cmake ..the .. will point to the parent location where your code is.
If all goes well, cmake will process your CMakeLists.txt files, find the location of all libraries and include paths and spew a bunch of configuration information including a traditional Makefile in your build directory.
From here, you can use the traditional make stated in the previous item.
Run make in your build directory
--> A guide for cmake can be found here: https://www.cs.swarthmore.edu/~adanner/tips/cmake.php
ccmake is an interface for cmake. Project configuration can be specified interactively through this GUI.
--> A guide for ccmake https://cmake.org/cmake/help/v3.0/manual/ccmake.1.html
CMakeLists.txt: You can create a file called 'CMakelists.txt'.