【问题标题】:What is the location of stdlib.h in XCode 4.3?XCode 4.3 中 stdlib.h 的位置是什么?
【发布时间】:2012-02-22 17:57:33
【问题描述】:

请告诉我,stdlib.h 在 XCode 4.3 中的位置是什么?

【问题讨论】:

  • 不能说 4.3,但在我的机器上使用 XCode 4.2 locate stdlib.h | grep /stdlib\.h$ 输出 /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/tr1/stdlib.h /Developer/SDKs/MacOSX10.6.sdk/usr/include/stdlib.h /usr/include/c++/4.2.1/tr1/stdlib.h /usr/include/stdlib.h
  • @darkmist Apple 已将 Xcode 4.3 捆绑到单个应用程序包中,现在很难找到东西...

标签: xcode xcode4 xcode4.3


【解决方案1】:

4.3 之前的 Xcode 版本中 /Developer 中的内容现在包含在 Xcode.app 捆绑包中。有多个,每个支持的 SDK 和平台一个:

$ find /Applications/Xcode.app -name stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include/stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/include/stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/stdlib.h

【讨论】:

  • 非常感谢!您不仅告诉我在哪里可以找到它,还告诉我找到其他头文件的好方法!
【解决方案2】:

如果您安装命令行工具(Xcode > Preferences > Downloads),则该文件位于/usr/include/stdlib.h

【讨论】:

    【解决方案3】:

    我认为您应该使用unistd.h 而不是stdlib.h。我在导入 stdlib.h 时尝试使用 sleep() 时遇到问题,我必须导入 unistd.h

    【讨论】:

    • stdlib 由 POSIX 指定。你不应该解决它。 bames53(下)有正确的答案(通用解决方案,即使对于非 Xcode 命令行构建)。 trojanfoe(上图)回答了一个没有被问到的问题(与 Xcode 构建有关)。另外,有时你没有那种纬度(stdlib.h -> unistd.h)
    猜你喜欢
    • 1970-01-01
    • 2014-07-31
    • 2014-03-26
    • 1970-01-01
    • 1970-01-01
    • 2010-11-11
    • 2020-09-18
    • 1970-01-01
    • 2011-03-17
    相关资源
    最近更新 更多