Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
谷歌测试和XCode 4.6_Xcode_Testing - Fatal编程技术网

谷歌测试和XCode 4.6

谷歌测试和XCode 4.6,xcode,testing,Xcode,Testing,XCode 4.6.3中的google测试存在问题 大家好, 我已经将google测试集成到我的XCode项目中,并使用基本的命令行工具 单元测试似乎工作正常(添加了guest.framework,正确设置了DYLD_LIBRRY_路径) 但是,只要我添加到对象fixture EXPECT_EQ(0,object.PublicMember)类型 测试时,我得到以下链接器错误 Ld /Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxC

XCode 4.6.3中的google测试存在问题

大家好,

我已经将google测试集成到我的XCode项目中,并使用基本的命令行工具 单元测试似乎工作正常(添加了guest.framework,正确设置了DYLD_LIBRRY_路径)

但是,只要我添加到对象fixture EXPECT_EQ(0,object.PublicMember)类型 测试时,我得到以下链接器错误

Ld /Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX-hbmvfkmcscchsvebxpaefvzmkvdp/Build/Products/Debug/UnitTest normal x86_64
cd /Users/rinkevic/Development/VeloxChemX
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX-hbmvfkmcscchsvebxpaefvzmkvdp/Build/Products/Debug -F/Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX-hbmvfkmcscchsvebxpaefvzmkvdp/Build/Products/Debug -F/Users/rinkevic/Development/Frameworks -F/Users/rinkevic/Development/VeloxChemX/../../Library/Frameworks -F/Users/rinkevic/Development/VeloxChemX/../Frameworks -filelist /Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX-hbmvfkmcscchsvebxpaefvzmkvdp/Build/Intermediates/VeloxChemX.build/Debug/UnitTest.build/Objects-normal/x86_64/UnitTest.LinkFileList -mmacosx-version-min=10.8 -stdlib=libc++ -framework gtest -framework OpenCL -o /Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX-hbmvfkmcscchsvebxpaefvzmkvdp/Build/Products/Debug/UnitTest


Undefined symbols for architecture x86_64:
"testing::internal::EqFailure(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)", referenced from:testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&) in TestCartMom.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ld/Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX hbmvfkmcscchsvebxpaefvvzmkvdp/Build/Products/Debug/UnitTest normal x86_64
cd/Users/rinkevic/Development/VeloxChemX
setenv MACOSX_部署_目标10.8
/Applications/Xcode.app/Contents/Developer/toolschains/xcodefault.xtoolschain/usr/bin/clang++-arch x86_64-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk-L/Users/rinkevvic/Library/Developer/Xcode/DerivedData/veloxchemHBMVFKCSCCHSEVEBxAEFVZMKVDP/Build/Products/Debug-F/Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX hbmvfkmcscchsvebxpaefvzmkvdp/Build/Products/Debug-F/Users/rinkevic/Development/Frameworks-F/Users/rinkevic/Development/VeloxChemX/./../Library/Frameworks-F/Users/rinkevolution-list/Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX hbmvfkmcscchsvebxpaefvzmkvdp/Build/Intermediates/VeloxChemX.Build/Debug/UnitTest.Build/Objects-normal/x86_64/UnitTest.LinkFileList-mmacosx version min=10.8-stdlib=libc++-framework gtest-framework OpenCL-o/Users/rinkevic/Library/Developer/Xcode/DerivedData/VeloxChemX hbmvfkmcscchsvebxpaefvzmkvdp/Build/Products/Debug/UnitTest
架构x86_64的未定义符号:
“测试::内部::EqFailure(char const*,char const*,std::uu 1::basic_string const&,std:uu 1::basic_string const&,bool)”,引用自testing::AssertionResult testing::内部::CmpHelperEQ(char const*,char const*,int const&,int const&)
ld:找不到架构x86_64的符号
叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用)

有什么建议我做错了什么吗

这是因为单元测试项目的构建选项与gtest项目不同。
确保构建选项如“Apple LLVM-Language”和“Apple LLVM-Language-C++”都是相同的。

我也遇到了同样的问题


在这两个项目中都选择libstdc++。

这里概述了另一个解决方案:它不使用框架,而是安装到/usr/local中,从而为情况带来了一些理智

请记住,必须重命名libs以“lib”开头,例如libgtest.a

还要记住,您必须同时链接到libgtest.a和libgtest_main.a。如果没有后者,您将收到关于缺少主要方法的投诉


关于C++方言和库的评论是适用的,但是我发现在生成框架并试图链接到它时很难控制这些。

< P>默认General.xcconfig指向10.4 SDK,将它改为10.10个固定问题,对于我< /P>可能的解决方案: