gpt4 book ai didi

iphone - 如何将 gcc 4.2 与 Xcode 4.2 一起使用

转载 作者:行者123 更新时间:2023-12-03 19:36:42 26 4
gpt4 key购买 nike

对于一些较旧的代码,我需要将 gcc 4.2 与 Xcode 4.2 一起使用。我如何让它显示向上。 Xcode4.2似乎已经放弃了对它的支持。

谢谢

最佳答案

这是一种在 xcode 4.2 中启用 gcc 4.2 编译的方法。这主要是通过命令行完成的,因此当您看到以以下开头的行时:[ 15:30 jon@MacBookPro/]$,您需要打开Terminal.app并运行在 $ 之后开始的命令。

No files or directories are removed or deleted in this process, so it is easy to undo if you need to compile with LLVM in the future.

  1. 下载 - 但尚未安装 - xcode_4.1_for_lion.dmgxcode_4.1_for_snow_leopard.dmg

  2. 现在,按照以下步骤将 Xcode 4.1 安装到 /Developer-4.1 中:

    1. 备份工作 /Developer 目录(安装 Xcode 4.2 的位置)

    2. [ 15:30 jon@MacBookPro / ]$ sudo mv -v /Developer /Developer-4.2
    3. 使用默认安装位置 (/Developer) 运行 Xcode 4.1 安装程序

    4. 将新的 Xcode 4.1 安装移动到 /Developer-4.1:

      [ 15:30 jon@MacBookPro / ]$ sudo mv -v /Developer /Developer-4.1
    5. 将 Xcode 4.2 开发人员目录移回 /Developer:

      [ 15:30 jon@MacBookPro / ]$ sudo mv -v /Developer-4.2 /Developer
  3. 编辑 Xcode 4.2 GCC 4.2.xcspec 文件以使 gcc 4.2 显示在编译器选项列表中[1]:

    [ 15:30 jon@MacBookPro / ]$ sudo vi "/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2 (Plausible Blocks).xcplugin/Contents/Resources/GCC 4.2.xcspec"
    • 4142 行从此更改:

      ShowInCompilerSelectionPopup = NO;
      IsNoLongerSupported = YES;
    • 致此:

      ShowInCompilerSelectionPopup = YES; 
      IsNoLongerSupported = NO;
  4. 备份 Xcode 4.2 iOS/Simulator Framework usr 目录:

    [ 15:30 jon@MacBookPro / ]$ sudo mv -v /Developer/Platforms/iPhoneOS.platform/Developer/usr /Developer/Platforms/iPhoneOS.platform/Developer/usr.backup
    [ 15:30 jon@MacBookPro / ]$ sudo mv -v /Developer/Platforms/iPhoneSimulator.platform/Developer/usr /Developer/Platforms/iPhoneSimulator.platform/Developer/usr.backup
  5. 将 Xcode 4.1 iOS/Simulator Framework usr 目录复制到 Xcode 4.2:

    [ 15:30 jon@MacBookPro / ]$ sudo cp -rv /Developer-4.1/Platforms/iPhoneOS.platform/Developer/usr /Developer/Platforms/iPhoneOS.platform/Developer/usr
    [ 15:30 jon@MacBookPro / ]$ sudo cp -rv /Developer-4.1/usr /Developer/Platforms/iPhoneSimulator.platform/Developer/usr
  6. gccinfo iOS SDK 库目录从 Xcode 4.1 复制到 Xcode 4.2 [2]:

    [ 15:30 jon@MacBookPro / ]$ sudo cp -rv /Developer-4.1/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/gcc /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/gcc
    [ 15:30 jon@MacBookPro / ]$ sudo cp -rv /Developer-4.1/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/info /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/info
  7. 使用gcc-4.2编译!

    Screenshot of CGG 4.2 in xcode 4.2

<强> This is a blog post I've written with a little more info about this process. Feel free to leave a comment on the blog if you run into any issues or have any questions.

<小时/>

[1] 如果从命令行打开(使用诸如 viemacsnano、等)确保将路径括在引号 "/long path/withspaces/in it/file.xcspec" 中或转义空格 /some/long\path/with\spaces/in\it/file.xcspec

[2] 这是必要的,因为 iPhoneOS.platform SDK 有自己单独的 /usr/lib 目录,但 iPhoneSimulator.platform SDK 没有

关于iphone - 如何将 gcc 4.2 与 Xcode 4.2 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7786302/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com