I'm creating a project on c and when i make my Makefile and try to run it it gives me this error:
Makefile:1: *** missing separator. Stop.
My makefile code is:
CC=gcc
OBJ=./objetos
INC=./include
FON=./aqsFonte
BIB=./bibliotecas
OPBIB=-lBiblioteca
ProjetoFinal: libFinal.a
$(CP) $(FON)/ProjetoFinal.c -I$(INC) -L$(BIB) $(OPBIB) -o ProjetoFinal
Bibliotecas.a: Caminho.o Libs_Defines.o Matrizes.o Proc_Imagens.o Vetores.o
ar -q $(BIB)/libFinal.a Caminho.o ibs_Defines.o Matrizes.o Proc_Imagens.o Vetores.o
Caminho.o:
$(CP) $(FON)/Caminho.c -o Caminho.o
Libs_Defines.o :
$(CP) $(FON)/Libs_Defines.c -o Libs_Defines.o
Matrizes.o:
$(CP) $(FON)/Matrizes.c -o Matrizes.o
Proc_Imagens.o:
$(CP) $(FON)/Proc_Imagens.c -o Proc_Imagens.o
Vetores.o:
$(CP) $(FON)/Vetores.c -o Vetores.o
Also, it's all tabbed correctly I guess.
can you try running -
(after saving a backup of course)
You're probably using a modern text editor that understands the unicode standard. -- Even if you open an ANSI file in these editors, they'll usually save them back out as UTF-8 -- which is very backwards compatible, except that it places two "invisible" bytes at the beginning of the file, so that other programs will know what format the text is encoded with. -- This is why the "error" is reported on line 1.
If you're using Notepad for Windows, you're in luck, as there is an option to override this behavior and save the file in the "ANSI" format. Here's how:
Change "Encoding" from "UTF-8" to "ANSI".
It's a tabs problem. Some text editors may replace tabs with white spaces, make sure you use a proper text editor that doesn't mess it up. Open your makefile in vi or any other rudimentary editor, and rewrite that makefile.
Note that after each target rule, one single tab must be placed in the beginning of the line. Everything that comes after that tab is passed on to the shell (there can be more tabs, spaces, and whatever you want, but keep in mind that there must be a tab in the beginning of the line).
I just meet the same problem when compliling my source code with auto generated gcc makefile.
I finally found it was caused by the utf-8 BOM characters at the beginning of the makefile.These charaters are invisible in some text editors.
so try save the file as utf-8 without BOM.
actually i faced a similar problem every thing was right but later i understood i use g-edit ill tell the solution edit>preferances>editor tab>uncheck the button (insert spaces instead of tabs) and it worked just fine
make is very sensitive on the way rules and targets are indented. The error you post is usually caused by indenting the rule of a target with spaces instead of a single tab.
for example:
will error, but
will not.