Make error: missing separator

后端 未结 12 2072
说谎
说谎 2020-11-22 08:07

I am getting the following error running make:

Makefile:168: *** missing separator.  Stop.

What is causing this?

相关标签:
12条回答
  • 2020-11-22 08:33

    In my case, this error was caused by the lack of a mere space. I had this if block in my makefile:

    if($(METHOD),opt)
    CFLAGS=
    endif
    

    which should have been:

    if ($(METHOD),opt)
    CFLAGS=
    endif
    

    with a space after if.

    0 讨论(0)
  • 2020-11-22 08:34

    As indicated in the online manual, the most common cause for that error is that lines are indented with spaces when make expects tab characters.

    Correct

    target: 
    \tcmd
    

    where \t is TAB (U+0009)

    Wrong

    target:
    ....cmd
    

    where each . represents a SPACE (U+0020).

    0 讨论(0)
  • 2020-11-22 08:35

    I had the missing separator file in Makefiles generated by qmake. I was porting Qt code to a different platform. I didn't have QMAKESPEC nor MAKE set. Here's the link I found the answer:

    https://forum.qt.io/topic/3783/missing-separator-error-in-makefile/5

    0 讨论(0)
  • 2020-11-22 08:44

    This is a syntax error in your Makefile. It's quite hard to be more specific than that, without seeing the file itself, or relevant portion(s) thereof.

    0 讨论(0)
  • 2020-11-22 08:44

    In my case, I was actually missing a tab in between ifeq and the command on the next line. No spaces were there to begin with.

    ifeq ($(wildcard $DIR_FILE), )
    cd $FOLDER; cp -f $DIR_FILE.tpl $DIR_FILE.xs;
    endif
    

    Should have been:

    ifeq ($(wildcard $DIR_FILE), )
    <tab>cd $FOLDER; cp -f $DIR_FILE.tpl $DIR_FILE.xs;
    endif
    

    Note the <tab> is an actual tab character

    0 讨论(0)
  • 2020-11-22 08:46

    My error was on a variable declaration line with a multi-line extension. I have a trailing space after the "\" which made that an invalid line continuation.

    MY_VAR = \
       val1 \ <-- 0x20 there caused the error.
       val2
    
    0 讨论(0)
提交回复
热议问题