0

I recently started learning C language on Ubuntu 15.10 .Today I learned about Makefile from http://c.learncodethehardway.org/book/ex2.html .But the problem is I keep on getting error

bharat@ratcoder:~/Programing/C$ make Makefile:4: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.

I know I have to use Tab key instead of spaces and I am using the Tab key,But when using Tab does not solve my problem I tried googling and use

:%s/^[ ]+/^I/

this in vim as advised here https://unix.stackexchange.com/questions/125757/error-while-executing-make-commad-in-ubuntu-terminal. But still I get the same error as above,so someone please help me where I am wrong or what should I do.I am new to Ubuntu.

  • pls provide the full output when you run make command, with the single line it is difficult to understand where the problem occurs. – ostendali Jan 4 '16 at 12:06
  • My makefile is same as in the link above c.learncodethehardway.org/book/ex2.html and the complete command >>bharat@ratcoder:~/Programing/C$ make Makefile:4: *** missing separator (did you mean TAB instead of 8 spaces?). Stop. – bha159 Jan 4 '16 at 12:16
  • Unless you're familiar ith vim I'd recommend not trying to use a regex replacement - there's only one line, just open Makefile in a "normal" editor,delete the spaces and type a tab. FWIW the expression you found looks a little off to me: it needs to be \+ instead of just +, and don't forget ^I isn't a literal ^I (it needs to be composed using Ctrl-V-TAB) – steeldriver Jan 4 '16 at 12:55
  • @steeldriver which editor should be used?I have vim,sublime text2 and of course gedit. – bha159 Jan 4 '16 at 14:10
  • You can use any editor you like - Makefiles are plain text – steeldriver Jan 4 '16 at 14:11
1

By changing the settings in gedit solved the problem.

Edit menu --> Preferences --> Editor --> Tab Stops

and uncheck

insert spaces instead of tab

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.