Usually this is set to "make", but Visual C++ users The name of the program to run when the " :make" command is executed is definedīy the 'makeprg' option. Other commands to move around in the error list: :clist! 1 gcc -g -Wall -o prog main.c sub.c 2 main.c: In function 'main': 3 main.c:6: too many arguments to function 'do_sub' 4 main.c: At top level: 5 main.c:10: parse error before '}' 6 make: *** Error 1 To see all the messages add a " !" to the command: Output from the linker, for example, about an undefined function. However, sometimes unrecognized lines do contain something you want It assumes those are the interesting lines and the rest is just boring Only the lines where Vim recognized a file name and line number are listed :clist 3 main.c: 6:too many arguments to function 'do_sub' 5 main.c: 10:parse error before '}' You can get an overview of all the error messages with the " :clist" command. When there is not enough room, Vim will shorten the error message. Vim jumps to line 10, the last line in the file, where there is an extra ' }'. The following command goes to where the next error occurs: |(3 of 12): too many arguments to function 'do_sub' | The line number, Vim knew where to go by looking in the error messages. Press, Vim displays the file "main.c", with the cursor positioned on :!make | &tee /tmp/vim215953.err gcc -g -Wall -o prog main.c sub.c main.c: In function 'main': main.c:6: too many arguments to function 'do_sub' main.c: At top level: main.c:10: parse error before '}' make: *** Error 1 2 returned "main.c" 11L, 111C (3 of 6): too many arguments to function 'do_sub' Hit ENTER or type command to continueįrom this you can see that you have errors in the file "main.c". (Typical :make sessions generateįar more errors and fewer stupid ones.) After typing " :make" the screen looks Take a look at an example " :make" session. If errors were generated, they are captured and the editor positions you where The following command runs the program "make" (supplying it with any argument Until finally your program compiles without any error. You can then recompile and fix any new errors that are found Program from within Vim and then go through the errors generated and fix them Vim has a set of so called " quickfix" commands. Previous chapter: | usr_29.txt| Moving through programs Next chapter: | usr_31.txt| Exploiting the GUI Program and directly jump to reported errors. Vim has various commands that aid in writing computer programs. Vim documentation: usr_30 Vim documentation: usr_30 main help file
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |