即使安装了命令行工具,GCC也无法在OS X上找到stdio.h

俄罗斯猫头鹰

我正在使用OS X 10.10.4,无法编译.c文件。我在此问题上找到的大多数帮助都建议安装Xcode的命令行工具,但是尝试这样做会给

xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

我使用了find选项来找到stdio.h

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

所以很明显有几个位置。

我尝试在编译时添加'-v'标志,以尝试获得更多的见解,并发现搜索的不够彻底。

#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

有人可以帮忙吗?

激光
  • 首先,OSX上的默认编译器是clanggcc因此使用起来更好clang
  • 如果必须使用gcc,可以通过编译选项设置标题搜索路径-I option例如: gcc -Ipath_to_headers yourprogram.c -o yourprogram

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

pip在Mac OS X Mavericks(10.9)上引发stdio.h找不到错误

即使PIP安装可以识别libffi,也无法找到ffi.h

即使安装了纱线,也无法找到模块“纱线”

从macOS Catalina上的源代码编译LLVM(如何解决“ stdio.h”未找到)

Crosscompilation GCC工具链无法找到文件stdlib.h

在Mac上安装CMake命令行工具

Typescript编译器即使已经安装了Jquery类型定义也无法找到它们

Windows 10 DISM即使安装了ISO也无法找到文件

ctags无法正确解析stdio.h

即使安装了axios cancel令牌,也无法在已卸载的组件上执行React状态更新

即使我已经在机器上安装了git,也无法对其进行配置

已安装鼻子,但无法在命令行上使用

我怎么知道是否通过命令行在Ubuntu上安装了桌面环境?

无法在Mac OS上使用Go命令行

即使安装了RDF4J捆绑包,OpenDaylight OSGi也无法找到RDF4J类

如何使用MacPorts在OS X上安装Postgres命令行客户端(psql)?

$ http获取离子即使在安装了cordova-plugin-whitelist的情况下也无法在实际设备上运行

Mac上的小指命令行工具?

GCC在Alpine Linux中找不到stdio.h

GCC 编译器找不到 stdio.h

macOS命令行工具和gcc在Catalina上突然失败(在Mojave上工作)

在命令行上安装了一个包,可以通过命令行导入它。在 jupyter notebook 中导入时收到 ModuleNotFoundError

即使安装了工具也无法运行.net ef

Visual Studio 2017 for Dymola无法打开stdio.h

如何在Windows或Linux上安装dns-sd命令行测试工具?

在Ubuntu上运行OS X命令行程序

Xcode GM:OS X命令行工具项目没有速成语言吗?

OS X使用命令行工具使用iSight拍照吗?

命令行工具不起作用-OS X El Capitan,Sierra,High Sierra,Mojave