make / gcc / clang查找带有空白文件名的文件,给出错误

时间:2016-05-13 23:40:34

标签: gcc makefile clang

我有OSX 10.11.4,Xcode 7.3.1。 使用make --调用gcc --调用clang,我发现此错误,其中clang正在查找名称为空格的文件!

Make error 1: clang: error: no such file or directory: ' '. 

这是一个空间!

我不知道如何解决这个问题。 makefile格式正确。 这是make:

输出的结尾
gcc -g -v -Wall -I/usr/local/include -I/opt/local/include -I/Users/m/BioPrep \
      -o mod \
      ../mshell/runit0.o \
      ../mshell/tline.o \
      ../mshell/getshm.o \
      ../mshell/callLSODA.o \
      ../mshell/extras.o \
      ../mshell/nrutil.o \
      ../mshell/exten.o \
      ../choosedisp/choosedisp_main.o \
      ../choosedisp/choosedisp_cb.o \
      ../choosedisp/choosedisp_fm.o \
      ../connectdisps/connectdisps.o \
      ../connectdisps/opwsock.o \
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

clang: error: no such file or directory: ' '

make: *** [mod] Error 1

=======================以下是Makefile的内容:

# This is Makefile with all graphics code removed so that a compilation of mod can proceed
#  "MakefileA" has the graphics files present but commented (#) out
CC = gcc
CFLAGS = -g -v -Wall
INCL = -I/usr/local/include -I/opt/local/include -I/Users/prowat/BioPrep
LIBS = -L/usr/local/lib -L/opt/local/lib -lX11 -lforms


mod: model.o \
     ../mshell/runit0.o \
     ../mshell/tline.o \
     ../mshell/getshm.o \
     ../mshell/callLSODA.o \
     ../mshell/extras.o \
     ../mshell/nrutil.o \
     ../mshell/exten.o \
     ../choosedisp/choosedisp_main.o \
     ../choosedisp/choosedisp_cb.o \
     ../choosedisp/choosedisp_fm.o \
     ../connectdisps/connectdisps.o \
     ../connectdisps/opwsock.o \
     ../lsoda/liblsoda.a`  
        cd ../mshell; make objs`  
        cd ../choosedisp; make objs`  
        cd ../connectdisps; make objs`  
        $(CC) $(CFLAGS) $(INCL) \
          -o mod \
          ../mshell/runit0.o \
          ../mshell/tline.o \
          ../mshell/getshm.o \
          ../mshell/callLSODA.o \
          ../mshell/extras.o \
          ../mshell/nrutil.o \
          ../mshell/exten.o \
          ../choosedisp/choosedisp_main.o \
          ../choosedisp/choosedisp_cb.o \
          ../choosedisp/choosedisp_fm.o \
          ../connectdisps/connectdisps.o \
          ../connectdisps/opwsock.o \
          model.o \
          -L../lsoda -llsoda \
          $(LIBS) \
          -lm

=====================

1 个答案:

答案 0 :(得分:3)

请使用正确的格式:对于代码块,缩进4个空格。反引号仅用于普通文本中的固定宽度字体。

您可能已经寻找空间,但您需要再次查看。根据输出make显示你和你的makefile,很明显在这一行末尾的反斜杠之后至少有一个空格:

      ../connectdisps/opwsock.o \

你可以这样说,因为如果在这个反斜杠之后没有空格,那么它将继续到下一行,并且可以显示编译行的其余部分:

      model.o \
      -L../lsoda -llsoda \
      $(LIBS) \
      -lm

由于提供的输出make中缺少这些行,您可以确定opwsock.o行的某些内容阻止make在结束时识别反斜杠/换行符。