【问题标题】:Xcode Issue "_main"Xcode 问题“_main”
【发布时间】:2014-10-19 07:24:00
【问题描述】:

我已经被这个问题困扰了一段时间了。无数小时和时间,我仍然无法弄清楚。我有这个问题的解决方案吗?

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/libyoyo_interpreted.a,该文件是为存档而构建的,该文件不是所链接的体系结构 (i386):PumpkinMenace/Supporting Files/libyoyo_interpreted.a
架构 i386 的未定义符号:
“_main”,引用自:
主可执行文件的隐式入口/启动
ld:未找到体系结构 i386 的符号
clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

【问题讨论】:

    标签: xcode


    【解决方案1】:

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

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

    下面是 main 函数的样子:

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

    【讨论】:

    • 所以我只需在支持文件中添加一个新文件,然后导入该代码?也非常感谢!
    【解决方案2】:

    “架构 i386 的未定义符号”

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-23
      • 1970-01-01
      • 2011-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多