Let GTEST_DIR
be the environment variable storing the path to the googletest
directory. (I cloned googletest-master from googletest\'s github repo.
The problem seems to be due to some linking issues. Have you used the linker flags correctly. For gtest, we need to compile with -lgtest and the linker can link it correctly. Similarly, we need to have the flags for all possible libraries that we are linking against.
The code
TEST(dummy_test, test1) { EXPECT_EQ(1,1); }
int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
compiles perfectly for me with command
clang++ -std=c++11 main.cpp -lgtest
and I could run the single test without an issue.