使用protobuf的架构i386的未定义符号

时间:2012-01-05 16:07:08

标签: iphone objective-c xcode4 protocol-buffers i386

我正在尝试制作一个使用Protocol Buffers的应用。我收到这个错误,知道为什么?

Ld /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app/PBTest normal i386
cd /Users/fmota/Documents/Developer/Protobuf/PBTest
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator -F/Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator -filelist /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Intermediates/PBTest.build/Debug-iphonesimulator/PBTest.build/Objects-normal/i386/PBTest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework SystemConfiguration -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app/PBTest

Undefined symbols for architecture i386:
   "_OBJC_CLASS_$_AreaRequest_Builder", referenced from:
       objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

3 个答案:

答案 0 :(得分:0)

是的,这是我见过的常见问题。

查看this nearly duplicate question的答案,并告诉我它是否能为您解决问题。 : - )

答案 1 :(得分:0)

将* .pb.h和* .pb.m添加到“TARGET” - >“Build Phases” - >“Compile Sources”!

答案 2 :(得分:0)

我的工作环境是xcode 5.0.2。

将* .pb.m添加到“TARGET” - >“构建阶段” - >“编译源代码”

在添加* .pb.h之后,不要添加* .pb.h,它无法链接。