我对MacOS环境还不太熟悉,之前在编译C脚本时遇到了一些问题。我的问题如下:
fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
我尝试重新安装xcode-select --install
,但一直提示:
xcode-select: error: 命令行工具已经安装,请使用“软件更新”安装更新
我已经更新了一切,但问题依然存在。显然是因为我没有/usr/includes
文件。我找到了一种方法来编译我的软件,使用:
/Library/Developer/CommandLineTools/usr/bin/g++ XXXX.cpp
然而,现在我正在尝试./compile
并make
另一个软件,但我不知道如何默认使用这个gcc解释器。当我尝试执行./configure时,我得到以下错误:
configure: error: 无法运行C编译程序。如果您想交叉编译,请使用“--host”。有关详细信息,请参见“config.log”
因此,当我查看config.log
时:
configure:3224: checking for gcc
configure:3240: found /usr/local/bin/gcc
configure:3251: result: gcc
configure:3282: checking for C compiler version
configure:3291: gcc --version >&5
gcc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3302: $? = 0
configure:3291: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC)
configure:3302: $? = 0
configure:3291: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3302: $? = 1
configure:3291: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3302: $? = 1
configure:3322: checking whether the C compiler works
configure:3344: gcc conftest.c >&5
configure:3348: $? = 0
configure:3396: result: yes
configure:3399: checking for C compiler default output file name
configure:3401: result: a.out
configure:3407: checking for suffix of executables
configure:3414: gcc -o conftest conftest.c >&5
configure:3418: $? = 0
configure:3440: result:
configure:3462: checking whether we are cross compiling
configure:3470: gcc -o conftest conftest.c >&5
conftest.c:15:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
configure:3474: $? = 1
configure:3481: ./conftest
./configure: line 3483: ./conftest: No such file or directory
configure:3485: $? = 127
configure:3492: error: in `/Users/XXXX/phyml':
configure:3494: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
你有任何想法可以修复它吗?
非常感谢!
/usr/includes
文件不存在;你的意思是说你没有/usr/include
文件夹吗?如果是这样...那是怎么发生的? - Amadanfatal error: 'stdio.h' file not found #include
^~~~~~~~~
1 error generated.
我该如何解决这个问题? - melpomene