gpt4 book ai didi

c - gcc48(从 Homebrew 软件下载)找不到stdio.h

转载 作者:行者123 更新时间:2023-12-05 01:35:57 24 4
gpt4 key购买 nike

我在 OSX Yosemite 上工作,我从 Homebrew 软件安装了 gcc-4.8

以下程序在编译时失败(例如 gcc-4.8 main.c):

#include <stdio.h>    

int main(void)
{
printf("hello world");

return 0;
}

错误:

main.c:8:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.

 $`gcc-4.8 -print-prog-name=cc1` -v

产量

ignoring nonexistent directory "/usr/local/Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/../../../../../../x86_64-apple-darwin14.3.0/include"
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include
/usr/local/include
/usr/local/Cellar/gcc48/4.8.4/include
/usr/local/Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include-fixed
/System/Library/Frameworks
/Library/Frameworks
End of search list.

$ find /usr/local/ -name "stdio.h" -print

产量

/usr/local//Cellar/gcc/5.2.0/include/c++/5.2.0/tr1/stdio.h
/usr/local//Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/include/ssp/stdio.h
/usr/local//Cellar/gcc48/4.8.4/include/c++/4.8.4/tr1/stdio.h
/usr/local//Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include/ssp/stdio.h
/usr/local//include/c++/4.8.4/tr1/stdio.h
/usr/local//lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include/ssp/stdio.h

现在我知道我可以通过 -I/path/to/directory 让编译器找到正确的头文件,但看在上帝的份上,这是 stdio.h!我不想为愚蠢的小程序做这件事。我该如何修复这个缺陷?

最佳答案

我最终删除了 brew formula 并重新安装了它。它现在可以工作了,我仍然不清楚它何时何地被破坏。

编辑原来这个问题已经发生了好几次了。每次我升级 OSX 或 Xcode 时都会发生。

关于c - gcc48(从 Homebrew 软件下载)找不到stdio.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35052611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com