我升级到XCode 4,我的一个项目将不再编译。有谁有这个问题?下面的完整错误堆栈(稍微重新格式化以便易读):
Ld /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator/viewer.app/viewer normal i386
cd /Users/stephen/projects/Quipper/iPhone-viewer
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/g++-4.2 \
-arch i386 \
-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk \
-L/Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator \
-L/Users/stephen/projects/Quipper/iPhone-viewer/AdMob \
"-L/Users/stephen/projects/Quipper/iPhone-viewer/Twitter+OAuth/Libraries & Headers" \
-L/Users/stephen/projects/Quipper/iPhone-viewer/FlurryLib \
-F/Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator \
-filelist /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Intermediates/viewer.build/Debug-iphonesimulator/viewer.build/Objects-normal/i386/viewer.LinkFileList \
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 \
-framework CoreGraphics -framework CoreData -lAdMob -framework iAd \
-framework StoreKit -framework MediaPlayer -lOAuth -lxml2.2 \
-framework MessageUI -framework CoreLocation -framework QuartzCore \
-framework CoreMedia -framework AVFoundation -framework SystemConfiguration \
-framework CoreAudio -framework AudioToolbox -framework Foundation \
-framework UIKit -lFlurry -framework OpenAL \
-o /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Products/Debug-iphonesimulator/viewer.app/viewer
ld: duplicate symbol _OBJC_IVAR_$_StartChallengeViewController.user_pack_id
in /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Intermediates/viewer.build/Debug-iphonesimulator/viewer.build/Objects-normal/i386/StartChallengeViewController-C52C140DA244D284.o
and /Users/stephen/Library/Developer/Xcode/DerivedData/viewer-dsbfkuoythcgojfrsktxcccyfnuj/Build/Intermediates/viewer.build/Debug-iphonesimulator/viewer.build/Objects-normal/i386/StartChallengeViewController-469DDEB33F89F484.o
for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
答案 0 :(得分:2)
您已声明一个全局iVar,其指定值(例如int i = 2;
)在两个不同的类中具有相同的名称,其中一个类为StartChallengeViewController
。如果清理项目(Cmd Shift K)无效,请尝试将其中一个iVar重命名为其他内容,或者不给它初始值。
答案 1 :(得分:1)
尝试:
清洁项目
将Base SDK设置为最新的iOS 将Deployment Target设置为您要为其构建的iOS版本。