直接从vim编译 [英] compile directly from vim
问题描述
我想编译cpp文件w / o关闭vi。
我知道:!g ++ file.cpp ,但我更喜欢:make ,因此我在.vimrc文件中添加了此行。
I'd like to compile cpp file w/o turning off vi.
I know the :!g++ file.cpp but I prefer :make so I added this line in .vimrc file
au FileType C set makeprg = gcc\%
au FileType Cpp set makeprg = g ++ \%
au FileType C set makeprg=gcc\ %
au FileType Cpp set makeprg=g++\ %
但我一直得到
make : 未指定目标并找不到makefile。停止 *消息。
任何人都可以告诉我我的设置有什么问题?
我用上面的选项编译成功。
but I keep getting
"make: No targets specified and no makefile found. Stop.* "message.
can anyone tell me what is wrong with my setting?
I use to compile successfully with the option above.
推荐答案
我应该更改 C,Cpp 变成 c,cpp ,那么它就可以正常工作。
谢谢大家,特别是 Rob Wells ,你的答案帮了我很多。谢谢。
I should change C,Cpp into c,cpp, then it works fine.
thank you all, especially Rob Wells, your answer helped me a lot. thank you.
这篇关于直接从vim编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!