0

Here is my makefile:

build: Starter.o Executor.o
    g++ Starter.o Executor.o -o Starter
Starter.o: Starter.c
    g++ -c Starter.c
Executor.o: Executor.c Executor.h
    g++ -c Executor.c
clean:
    rm *.o Starter 

What am I doing wrong to be getting this error?

"*** missing separator. Stop. "

wirly
  • 27
  • 6
  • That is not the entire error message. `make` prints the file name and line number too, as in `makefile:2: *** missing separator. Stop.`. Show the line number. – Eric Postpischil May 19 '21 at 00:16
  • 1
    Is that the _exact_, _complete_ error message? Can you cut and paste the exact error and format it? What line number does it say? If that line is a recipe, there's no TAB on that line. Use `cat -eT Makefile` to see; TAB chars will be replaced by `^I`. Most likely your editor is "helpfully" converting TABs into spaces before saving your file. – MadScientist May 19 '21 at 00:16
  • 1
    The file as you have presented it in the question contains spaces, not tabs. Check the actual file carefully. Your text editor may automatically expand tabs to spaces. If so, you need to turn that off, at least for this file. – Eric Postpischil May 19 '21 at 00:17
  • @EricPostischil Hi, the entire error message is this: Makefile:2: *** missing separator. Stop. There are tabs used in the real file (used space on the formatting here) – wirly May 19 '21 at 00:20
  • Copy and paste the output of `cat -et Makefile` into the question. – Eric Postpischil May 19 '21 at 00:26
  • @MadScientist Thanks for the help, you were right. cat -eT Makefile saw no Tabs, so I used a different editor to put the tabs in, and it is now working. Edit: In case anyone ever ran into this problem, I used VSCode and MobaXTerm's tabs, both did not work. Notepad++ did – wirly May 19 '21 at 00:27
  • @EricPostpischil I just got it working thanks for the help – wirly May 19 '21 at 00:27
  • It's surprising you had this problem with VSCode. VSCode has a "makefile mode" when you open a makefile, which will write TABs as TABs. If you're not seeing this, maybe you've modified the configuration of your editor in such a way that it overrides that behavior. Or maybe for some reason your file is not being opened using the "makefile mode" – MadScientist May 19 '21 at 01:25
  • 1
    Does this answer your question? [Make error: missing separator](https://stackoverflow.com/questions/920413/make-error-missing-separator) – Tejas Shetty Nov 05 '21 at 07:59

1 Answers1

0

use this cat -e -t -v makefile_name command to check tabs with ^I and line endings with $. please have a look into makefile:4: *** missing separator. Stop

thirdeye
  • 150
  • 7