我知道Mac OS X是一个基于Unix的系统。我听说C标准库如stdio.h位于/usr/local/include
或/usr/include
。但是这个目录中没有任何类型的库。我使用终端来搜索这个目录,我也使用命令如find ./ -iname "stdio.h"
,但没有出现。然而,奇怪的是,gcc -test.c -o test
命令解决。它怎么发生的?我想知道我的C库位于何处。 p.s我也使用Xcode。它与这个应用程序有关吗?帮我! 而且我有AWS EC2 linux服务器,并且它有两个我上面提到过的库。Mac中的“stdio.h”在哪里?
回答
如果您有Xcode,但尚未安装可选的命令行工具包,则标准包含和库可能无法在通常的位置找到。尝试:
$ find /Applications/Xcode.app -name stdio.h
,你可能会看到类似:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdio.h
然而,你可能要如果你打算做任何非Xcode中安装的命令行工具包(即命令线)编程。然后,您将看到/usr/include
和/usr/lib
中的常用标题和库。
谢谢。但是在我安装命令行工具后,只有/ usr/include有库文件。没有“/ usr/local/include”!这意味着,当我输入“cd/usr/local/include”时,出现错误:没有这样的文件或目录。可以吗? – user3595632 2015-02-06 10:17:26
@ user3595632没问题,'/ usr/local'传统上由附加SDK和包使用,而不是由平台供应商使用。 – Potatoswatter 2015-02-06 10:22:20
没错 -/usr/local用于安装第三方软件,以便在更新系统时不会被覆盖。系统的东西进入/ usr。 – 2015-02-06 10:22:49
在我的笔记本电脑中,它出现在许多地方,如/usr/include/stdio.h
和/usr/include/sys/stdio.h
和/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h
。
在文件夹
Applications/Xcode/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include
或相似。
创建/更新/usr/include
一个符号有检测库:
sudo ln -sf /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include /usr/include
以上路径可以通过搜索stdio.h中找到
find /Applications/Xcode.app -path '*/usr/include/stdio.h'
我必须做的这与每一个XCode/MacOS SDK更新,今天面对这与XCode 7升级。
一旦安装了命令行工具,它们就不能用xcode-select
重新安装,因此路径可能无法通过Mac AppStore升级进行更新。
卸载&重新安装XCode,然后运行xcode-select --install
可能会更新路径,但这是一种矫枉过正。
一些帖子也提到xcode-select --switch /Application/Xcode.app
,但我没有太多运气。
如果没有命令行工具安装,你可以运行:
xcode-select --install
一个对话框打开,为您接受许可协议等。
(这是从上述回答中遗漏的。)
这是最短的答案! – 2017-06-06 19:17:27
- 1. 哪里可以找到stdio.h的实现?
- 2. Windows中'stdio.h'的目标文件在哪里?
- 3. Mac上的debug.keystore在哪里?
- 4. Mac App的stdout在哪里?
- 5. Mac OS中“tee”的代码在哪里?
- 6. Mac在哪里apachectl Yosimite
- 7. mac在哪里? (osx el capitan)
- 8. 哪里是在Mac/OS X
- 9. 哪里是在Mac的Ansible的库
- 10. mac os x的opencv包在哪里?
- 11. 在Mac上安装Python dylibs在哪里?
- 12. 流星在Mac上安装在哪里?
- 13. 在Mac上,Flash cookie存储在哪里?
- 14. XUL 5 SDK for MAC在哪里?
- 15. nodeJS + jslint:在哪里安装mac OSX?
- 16. Mac OS X调试接口在哪里
- 17. stdio.h - 什么是libfile的名称,我在哪里可以找到它Linux
- 18. stdio.h中在OS X
- 19. Mac OS X上sched.h中的clone()方法在哪里
- 20. 我在哪里可以找到Mac OSX中的“launchd.conf”文件
- 21. 在Mac OS-X中安装sphinx-build在哪里?
- 22. 啤酒应用程序在Mac中存储在哪里?
- 23. stdio.h在Visual Studio
- 24. 应该在哪里.emscripten LLVM_ROOT和NODE_JS指向? (Mac OS X中)
- 25. 在Mac OSX High Sierra上,Safari 11的书签缓存在哪里?
- 26. 我在哪里把我的Ruby程序在Mac与终端
- 27. LogStash在mac上的日志文件在哪里?
- 28. 在Mac OS X上播放音频CD的API在哪里?
- 29. 使用MacPorts安装的Mac上的Gradle:Gradle home在哪里?
- 30. 这里的js在哪里
''头文件是C标准库的一部分,可能位于编译器搜索头文件的* any *目录中,例如它可能位于'/ usr/lib'的子目录中。另外,命令'find ./ -iname“stdio.h”'从* current *目录中搜索文件,所以如果你在例如你自己的主目录你将找不到该文件。 –
2015-02-06 09:59:04