我无法在Mac OS X 10.11上使用XCode 8.2.1的C编译器正常运行。我安装了最新的XCode并删除了所有现有的gcc二进制文件,但是仍然出现以下错误:

-- PCRE: Removing 'configure' log files
-- PCRE: PCRE_WORKING_DIR: /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE-build
-- PCRE: sh;/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE/configure;--prefix=/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE;--disable-shared
-- PCRE: Errors detected - See below.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... /Library/Developer/CommandLineTools/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE-build':
configure: error: C compiler cannot create executables
CMake Error at /Users/abc/Documents/Slicer/Slicer/CMake/ExternalProjectForNonCMakeProject.cmake:76 (message):
  PCRE: Error in configure step.  See
  /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step_output.txt
  and
  /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step_error.txt
Call Stack (most recent call first):
  /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step.cmake:3 (ExternalProject_Execute)
make[2]: *** [PCRE-prefix/src/PCRE-stamp/PCRE-configure] Error 1
make[1]: *** [CMakeFiles/PCRE.dir/all] Error 2
make: *** [all] Error 2


如何在配置上正确使用C编译器?

最佳答案

听起来您想从命令行运行C编译器(而不是在Xcode中)。

转到Apple的开发人员网站download section并下载Command Line Tools (macOS 10.12) for Xcode 8.2。这可能需要一个有效的开发者帐户。

直接链接当前为:Command Line Tools

关于c - 使C编译器在OS X上运行?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41793776/

10-10 20:36