Install Google Test (gtest) using Eclipse on OS X

What is the procedure for installing Google Test to work in Eclipse on Mac OS X? I followed the README statement to compile and install gtest as a framework from Xcode.

Now I want to use gtest with Eclipse. It currently compiles fine, but doesn't work at build time. I suppose Eclipse does not use a framework concept like XCode and needs a different approach to binding, but I'm not sure which files I should be linking to at build time.

g++ -L/usr/local/lib -L/usr/local/lib/libgtest.a -L/Library/Frameworks/gtest.framework -arch i386 -o "Raytracer"  ./test/sample_test.o  ./src/Raytracer.o   
Undefined symbols:
  "testing::Test::~Test()", referenced from:
      DemoTest_SANITY_Test::~DemoTest_SANITY_Test()in sample_test.o
      DemoTest_SANITY_Test::~DemoTest_SANITY_Test()in sample_test.o
  "testing::internal::AssertHelper::~AssertHelper()", referenced from:
      DemoTest_SANITY_Test::TestBody()      in sample_test.o
      DemoTest_SANITY_Test::TestBody()      in sample_test.o

      

+2


source to share


1 answer


The -L switch tells GCC the directory in which to look for libraries, the actual library should be linked with -l:



g++ -L/usr/local/lib -lgtest ...

      

+4


source







All Articles