2.2.1.3 : The compilation
The compilation is decomposed in 4 steps :- Create a build directory in the main directory of our project
- Go into it
- Call cmake
- Call make
So, let's create this build directory :
mkdir build
Then we go into it :
cd build
We call cmake :
cmake .. -- The C compiler identification is GNU 7.2.0 -- The CXX compiler identification is GNU 7.2.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: XXX/build
The .. is to call the parent directory as ../
Finally we call make :
1 2 3 4 5 |
make Scanning dependencies of target hadamard_product_memory_leak [ 50%] Building CXX object CMakeFiles/hadamard_product_memory_leak.dir/main.cpp.o [100%] Linking CXX executable hadamard_product_memory_leak [100%] Built target hadamard_product_memory_leak |
Now, let's execute our program :
./hadamard_product_memory_leak Hadamard product tabResult[0] = 0 tabResult[0] = 0 tabResult[0] = 0 tabResult[0] = 0 tabResult[0] = 0
It seems, the execution is ok, but we will check this with valgrind.