views:

542

answers:

1

What is the procedure to setup Google Test to work under Eclipse on Mac OS X? I followed the instruction in README to compile and install gtest as framework from XCode.

Now I want to use gtest with Eclipse. Currently, it compiles fine but fails during build. I suppose Eclipse does not use framework concept as XCode does and need a different linking approach, but I'm not sure which files should I link to during build.

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  A: 

The -L switch only tells GCC a directory where to look for libraries, the actual library must be linked with -l:

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