2012-02-22 140 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