googletest Undefined symbols for architecture x86_64 error
Let GTEST_DIR be the environment variable storing the path to the googletest directory. (I cloned googletest-master from googletest's github repo .) I cd 'ed into $GTEST_DIR , did a mkdir build && cd build , then executed the following command : cmake .. -DCMAKE_C_COMPILER=$GNU-6.0.0/bin/gcc-6.0.0 -DCMAKE_CXX_COMPILER=$GNU-6.0.0/bin/g++-6.0.0 where GNU-6.0.0 is the path to my gnu install. This generated a Makefile inside $GTEST_DIR/build that I tweaked as follows : I've added CC = $GNU-6.0.0/bin/gcc-6.0.0 CXX = $GNU-6.0.0/bin/g++-6.0.0 at its beginning, to be sure that the c and c++ compilers