I created a makefile
ex2.1.mak
CFLAGS=-Wall -g
clean:
rm -f ex1
But it shows Makefile:1: *** missing separator. stop.
I have only used tab and no spaces in the Makefile.
I created a makefile
ex2.1.mak
CFLAGS=-Wall -g
clean:
rm -f ex1
But it shows Makefile:1: *** missing separator. stop.
I have only used tab and no spaces in the Makefile.
Thanks for moving this to the forum for me.
The issue is that you are indenting with spaces but you must use an actual TAB character. Whatâs this tex editor youâre using? Can you set it to do a proper Makefile syntax with TABs?
GEdit as you can see in the screenshot. And Iâm using actual tab button
Hi! Try this.
Go to the Preferences for gedit (from the three horizontal bars next to âSaveâ on the top right coner).
Make sure that âInsert spaces instead of tabsâ is not ticked.
Already done that. Still not working.
Maybe tab width should be 4. Yours is only 1.
And my Makefile does not have the first line: ex2.1.mak
I wonder what that does?
I donât know, I just started learning and it was in ex2. If you know a working makefile for ex2 then plz tell
I simply copied from the textbook like this:
Note the tab width before ârmâ. You may set it to 4 in Preferences.
My tab key is to the left of my âQâ key. You may check yours.
If this still not works, you may skip to the next exercise until it mentions Makefile again.
I took the time to add the code tags like this:
[code]
CFLAGS=-Wall -g
clean:
rm -f ex1
[/code]
When you do that you can see that you have a space before clean as well 4 spaces before rm -f ex1
. Basically youâre adding spaces all over but should never use spaces ever in the beginning of a line. Every line with a space character at the beginning is wrong. In your text editor there should be a setting for showing you spaces, probably to put a slight dot on every space character. Enable that.
Also, not everyone uses Gedit so youâll have to figure out how to do these settings and shouldnât assume people use what you use.
Finally, you have to try to fix these things before running for help. Rather than going âItâs broken! Help!â ask yourself what could be wrong and try to fix it. If you donât change something in your file, then youâre not trying to fix it. It also helps to write a list of all the things that could be going wrong and then email it to yourself. This tricks your brain into solving it.
It was ex2 and I as someone with no prior knowledge of Linux and Makefile statement didnât knew what I was doing so, yes I tried, multiple times, even looked for forums and online Makefile tutorials but when I still failed I posted here. So donât judge anyone without exactly knowing about them.
Great, then youâre doing it the right way. Donât take my advice to attempt fixing it as any kind of accusation or claim that youâre stupid or lazy. Itâs more that I see it repeatedly that people struggle for only 30 minutes then run for help. If youâre actually changing files, trying different things, and trying different editors before asking for help, then youâre doing good.
There is a pretty important detail that I missed. The listing is named ex2.1.mak
. The makefile, however, needs to be named Makefile
. This happened when I read the paragraphs following the listing too quickly.
Hello good people
Is the file extension for Makefile .txt?
Sincerely
I resolved this issue.