Check out example codes for "compile c++ linux". It will help you in understanding the concepts better.

Code Example 1

g++ program.cpp
make program
./program

Code Example 2

g++ foo.cpp -o foo //plus other extension like the opencv to compile correctly

Learn ReactJs, React Native from akashmittal.com