{Vim} makefile: a small problem about tabs

Source: Internet
Author: User

Previously, I simply edited the vim configuration file named. vimrc in the home directory according to the online template, as shown below:

1 "<br/> 2 set hlsearch" high light search on <br/> 3 set backspace = 2 "delete any character in the file <br/> 4 set autoindent" auto indent on <br/> 5 set r0000" <br/> 6 set showmode "show which edit mode are you in <br/> 7 set nu" set number <br/> 8 set BG = Dark "background color <br/> 9 syntax on" <br/> 10 set laststatus = 2 <br/> 11 set autoindent <br/> 12 set shiftwidth = 4" set the size of autoindent is 4 <br/> 13 set softtabstop = 4 "Enter one tab, then 4 blank show <br/> 14 "set tabstop = 4 <br/> 15 set expandtab" Vim uses the rational blks to pad the tab <br/>


The following prompt appears when the result is made:

Makefile: 4: *** missing separator. Stop.



I have always thought that my configuration file is faulty, because this has never happened before! I have searched the internet for a long time. Although I found a way to correct this problem, I still did not find a way to avoid this error by modifying the. vimrc configuration file. Mark

. The following is a simple record of the problem solving process.

 

The cause of the problem is

Here is a detailed explanation.

Yes. The reason is that make cannot parse the content contained in makefile. GNU make identifies each line of makefile based on various separators (:, =, [Tab] characters) when reading makefile. The above error means that make cannot find a valid separator. The possible cause of this error message (maybe the editor, most of which is the MS-Windows Editor) is that four (or eight) commands are used before makefile commands) A space replaces the [Tab] character. Because all the command lines in makefile should start with the [Tab] character.

 

When I write the MAKEFILE file, the [Tab] is already used. To verify it, run the OD command to check my MAKEFILE file as follows:

Lianbequat @ Ubuntu:/home/advances/pthread/condition_var $ OD-T c makefile <br/> 0000000 C = g C/n C o n d 1: c o <br/> 0000020 n d 1. c/N $ (C) <br/> 0000040 $ ^-o $ @/n <br/> 0000051 <br/>


The [Tab] tab I typed has been automatically replaced with four spaces by the editor! Here

Find the answer to this problem, that is

In Vim editing mode, press Ctrl + V + I to write a tab key. Run the command again in make. Check my MAKEFILE file again in the ASCII code format and find that the four spaces have been replaced by "/T", as shown below:

Lianbequat @ Ubuntu:/home/advances/pthread/condition_var $ OD-T c makefile <br/> 0000000 C = g C/n C o n d 1: c o <br/> 0000020 n d 1. c/N/T $ (C) $ ^ <br/> 0000040-p t h r e a d-o $ @/n <br/> 0000057 <br/>

 


Note: The problem is not completely solved. It is impossible for me to use the combination key "Ctrl + V + I" to type each [Tab] key every time I write makefile ?! Therefore, you have to continue looking for problems. If I have not learned enough, I should first record it as "half-cut.



2011.1.10 Amendment

Find the cause, just comment out the configuration command in the last line of. vimrc! You can see it at a glance.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.