Xcode 问题 "_main"



我已经被这个问题困扰了一段时间。无数个小时和时间,我仍然想不出来。我有解决这个问题的办法吗?

Ld /Users/alangibson/Library/Developer/Xcode/DerivedData/PumpkinMenace-ddpkivitawzujwdpdfyngakgkyxs/Build/Products/Debug-iphonesimulator/PumpkinMenace.app/PumpkinMenace normal i386
    cd "/Users/alangibson/GameMaker-Studio/Pumpkin Menace/PumpkinMenace"
    export IPHONEOS_DEPLOYMENT_TARGET=5.1.1
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -L/Users/alangibson/Library/Developer/Xcode/DerivedData/PumpkinMenace-ddpkivitawzujwdpdfyngakgkyxs/Build/Products/Debug-iphonesimulator -L. -LFw -LPumpkinMenace -LFw/iOSSource -LPumpkinMenace/Game -LPumpkinMenace/Supporting Files -LFw/iOSSource/Source -LPumpkinMenace/Game/iOSSource -LPumpkinMenace/Supporting Files/__MACOSX -LPumpkinMenace/Supporting Files/games -LPumpkinMenace/Supporting Files/InAppSettings.bundle -LFw/iOSSource/Source/GoogleAdMobAdsSdkiOS-6.8.0 -LPumpkinMenace/Game/iOSSource/Source -LPumpkinMenace/Game/iOSSource/Source/GoogleAdMobAdsSdkiOS-6.8.0 -F/Users/alangibson/Library/Developer/Xcode/DerivedData/PumpkinMenace-ddpkivitawzujwdpdfyngakgkyxs/Build/Products/Debug-iphonesimulator -F/Users/alangibson/GameMaker-Studio/Pumpkin Menace/PumpkinMenace/Fw -F/Users/alangibson/GameMaker-Studio/Pumpkin Menace/PumpkinMenace/PumpkinMenace/Supporting Files -filelist /Users/alangibson/Library/Developer/Xcode/DerivedData/PumpkinMenace-ddpkivitawzujwdpdfyngakgkyxs/Build/Intermediates/Pumpkin Menace.build/Debug-iphonesimulator/PumpkinMenace.build/Objects-normal/i386/PumpkinMenace.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -objC -all_load -fobjc-arc -stdlib=libstdc++ -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.1.1 -liconv -framework CoreMedia -framework SystemConfiguration -framework EventKit -framework EventKitUI -framework CoreTelephony -framework CoreData -framework CoreText -framework StoreKit -framework MapKit -framework AddressBookUI -framework CFNetwork -framework MobileCoreServices -framework Security -lsqlite3.0 -framework AddressBook -framework CoreLocation -framework MessageUI -framework MediaPlayer -framework AudioToolbox -framework GameKit -framework AVFoundation -lz -framework OpenGLES -framework QuartzCore -framework OpenAL -framework UIKit -framework Foundation -framework CoreGraphics -lFlurry -lyoyo_interpreted -framework GameController -framework FacebookSDK -framework AdSupport -framework iAd -lGoogleAdMobAds -Xlinker -dependency_info -Xlinker /Users/alangibson/Library/Developer/Xcode/DerivedData/PumpkinMenace-ddpkivitawzujwdpdfyngakgkyxs/Build/Intermediates/Pumpkin Menace.build/Debug-iphonesimulator/PumpkinMenace.build/Objects-normal/i386/PumpkinMenace_dependency_info.dat -o /Users/alangibson/Library/Developer/Xcode/DerivedData/PumpkinMenace-ddpkivitawzujwdpdfyngakgkyxs/Build/Products/Debug-iphonesimulator/PumpkinMenace.app/PumpkinMenace

这是错误

ld:警告:忽略文件PumpkinMenace/Supporting Files/libyo_interpreted.a,该文件是为不是要链接的体系结构的存档而构建的(i386):Pumpkin梅纳ce/Supporting Files/libyo_terpreted.a
体系结构i386的未定义符号:
"_main",引用自:
主可执行文件的隐式输入/启动
ld:找不到体系结构i386的符号
clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

是的,每个iPhone项目都有一个"main.m"文件(在Xcode 6.1中,它通常隐藏在项目的"支持文件"文件夹中)。

如果您没有main.m文件(其中包含main C样式函数),这就是您看到错误的原因。

主要功能如下:

int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

"体系结构i386的未定义符号"

可能问题出在libyointerpreted.a文件中,因为它是为ios模拟器体系结构(i386)构建的,但您试图在设备(即arm7/armv7/arm64)上运行应用程序。

为arm7/armv7体系结构重建libyo_interpreted.a。(这对我有帮助http://blog.diogot.com/blog/2013/09/18/static-libs-with-support-to-ios-5-and-arm64/)

相关内容

最新更新