代码在iOS模拟器上编译并完美运行。 当我在Targer中添加“-ObjC”或“-all_load”时 - >构建设置 - >其他链接器标志然后编译并运行,xcode给出了我的这些错误:
duplicate symbol _cpSpacePointQuery in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpSpacePointQueryFirst in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpSpaceNearestPointQuery in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpSpaceNearestPointQueryNearest in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpSpaceSegmentQuery in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpSpaceSegmentQueryFirst in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpSpaceBBQuery in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpSpaceShapeQuery in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpSpaceQuery.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpSpaceQuery.o)
duplicate symbol _cpResetShapeIdCounter in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpShape.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpShape.o)
duplicate symbol _cpShapeInit in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpShape.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpShape.o)
duplicate symbol _cpShapeDestroy in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpShape.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpShape.o)
duplicate symbol _cpShapeFree in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpShape.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpShape.o)
duplicate symbol _cpShapeSetBody in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpShape.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpShape.o)
duplicate symbol _cpShapeCacheBB in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpShape.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpShape.o)
duplicate symbol _cpShapeUpdate in:
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libchipmunk iOS.a(cpShape.o)
/Users/Name/Library/Developer/Xcode/DerivedData/Game-frljocfxskmjcmesosyitnkinkmo/Build/Products/Debug-iphonesimulator/libcocos2dx iOS.a(cpShape.o)
更新: 我正在添加广告SDK,而一些SDK需要-ObjC和-all_load标志。删除-all_load修复了该问题。因此,任何类似的问题都可以忽略来自广告SDK教程的-all_load标志