After a little research, here is what I found out:
If your project library contains files like:
1) callMain.cpp, which calls a function to perform some operations
2) reverse.cpp, which contains the logic for changing the number, and 3) header.h, which contains the declaration of function prototypes
And if you have scripts of a script like unit test, such as unitTest1.cpp and unitTest2.cpp, which will be checked through gtest, then this can be done as follows:
g++ -I<gtest include directory location> -L<gtest directory location> <gtest_main.cc location> reverse.cpp unitTest1.cpp unitTest2.cpp -lgtest -lpthread -o test_try
Compiles and creates an executable file, for example test_try, which, when executed, gives the desired result. Please correct me if I am mistaken somewhere. Happy coding :)
source share