首先我知道这个问题已经在互联网上发布了很多次,但每次人们似乎都提供了不同的解决方案,我尝试了一些,但没有人为我工作。
所以当我构建我的应用程序时,我收到此错误:
Ld /Users/ahoura/Library/Developer/Xcode/DerivedData/Game-dkfwmqscuzprkpappmtrrrahhgtu/Build/Products/Debug-iphonesimulator/TinyWings.app/TinyWings normal i386
cd /Users/ahoura/Downloads/haqu-tiny-wings-e393aa3
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/llvm-g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/ahoura/Library/Developer/Xcode/DerivedData/Game-dkfwmqscuzprkpappmtrrrahhgtu/Build/Products/Debug-iphonesimulator -F/Users/ahoura/Library/Developer/Xcode/DerivedData/Game-dkfwmqscuzprkpappmtrrrahhgtu/Build/Products/Debug-iphonesimulator -filelist /Users/ahoura/Library/Developer/Xcode/DerivedData/Game-dkfwmqscuzprkpappmtrrrahhgtu/Build/Intermediates/Game.build/Debug-iphonesimulator/TinyWings.build/Objects-normal/i386/TinyWings.LinkFileList -mmacosx-version-min=10.6 -lz -Xlinker -objc_abi_version -Xlinker 2 -framework QuartzCore -framework OpenGLES -framework OpenAL -framework AudioToolbox -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/ahoura/Library/Developer/Xcode/DerivedData/Game-dkfwmqscuzprkpappmtrrrahhgtu/Build/Products/Debug-iphonesimulator/TinyWings.app/TinyWings
ld: duplicate symbol _screenWidth in /Users/ahoura/Library/Developer/Xcode/DerivedData/Game-dkfwmqscuzprkpappmtrrrahhgtu/Build/Intermediates/Game.build/Debug-iphonesimulator/TinyWings.build/Objects-normal/i386/pauseMenu.o and /Users/ahoura/Library/Developer/Xcode/DerivedData/Game-dkfwmqscuzprkpappmtrrrahhgtu/Build/Intermediates/Game.build/Debug-iphonesimulator/TinyWings.build/Objects-normal/i386/mainMenu.o for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
很多人似乎都说它与丢失的库有关,或者以特殊的方式包含文件!
注意我使用的是box2d,因此C和C ++是混合的,文件的扩展名为.mm
答案 0 :(得分:2)
这与丢失的库
无关您已在pauseMenu和mainMenu中定义了变量screenWidth。它只应在其中一个中定义。