在Mac OS X上设置Google Test以在Eclipse下工作的步骤是什么?我按照README中的指令从XCode编译和安装gtest作为框架。
现在我想在Eclipse中使用gtest。目前,它编译良好但在构建期间失败。我想Eclipse不像XCode那样使用框架概念,需要不同的链接方法,但我不确定在构建期间应该链接哪些文件。
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
答案 0 :(得分:4)
-L开关只告诉GCC一个查找库的目录,实际的库必须与-l连接:
g++ -L/usr/local/lib -lgtest ...