2012-02-22 59 views
9

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

+1

不能说4.3左右,但在我的机器上用XCode 4.2'找到stdlib.h | grep/stdlib \ .h $'outputs '/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' – 2012-02-22 18:08:15

+0

@darkmist Apple已将Xcode 4.3捆绑到单个应用程序包,现在很难找到东西... – 2012-02-22 19:07:35

回答

7

在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 
+0

非常感谢!你告诉我不仅在哪里可以找到它,而且还可以找到找到其他头文件的好方法! – 2012-02-23 18:07:33

1

我想你应该使用unistd.h而不是stdlib.h。我在导入stdlib.h时尝试使用sleep(),但必须导入unistd.h

+0

好的。你能告诉我unistd.h的位置吗? – 2012-02-22 19:06:05

+1

它位于/usr/include/unistd.h – larick 2012-02-22 21:15:49

+0

[stdlib](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdlib.h.html)由POSIX指定。你不应该解决它。 bames53(下面)有正确的答案(一般的解决方案,即使是非Xcode命令行版本)。 trojanfoe(上面)回答了一个没有被问到的问题(与Xcode构建有关)。另外,有时你没有那种纬度(stdlib.h - > unistd.h) – jww 2012-12-29 08:17:19

5

如果你安装了命令行工具(Xcode> Preferences> Downloads),那么该文件出现在/usr/include/stdlib.h