请告诉我,XCode 4.3 中 stdlib.h 的位置在哪里?
Xcode 4.3之前版本中的/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
/usr/include/stdlib.h
。unistd.h
而不是stdlib.h
。当导入stdlib.h
时,我在尝试使用sleep()时遇到了问题,我不得不导入unistd.h
。
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
- Andrey Starodubtsev