开发者

Compiling with C.vim on Windows?

C.Vim works, as evidenced by the commands I've been using, syntax highlighting, and template. But I use \rc and nothing happens. \rr tells me that there is no .exe, and an Everything search tells me that it's not a directory issue.

In all the resources I've read, I don't see anything that says I need to point it to a specific compiler, though I've installed Visual Studio 2010.

How do I get C.vim to compile my code? I'm a relative beginner with Vim and C.

Edit: I've set the Windows Environment Variable to C:/cygwin/bin where I've downloaded and installed the GCC packages, but am still getting the same error.

Edit2: I've downloaded Msys and Mingw as well. I tried setting up Eclipse as well, following the instructions here. Running make from the command line tells me that GNU Make 3.81 is running. Running :make in Vim tells me:

shell returned 2
(1 of 1) : make *** No targets specified and no makefile found

Trying Eclipse, I get another make error:

make: *** No rule to make target `all'; Stop.

Edit3: I got Code::Blocks running, which is what I used to run. (It's been a while since I progr开发者_开发知识库ammed, and even then I was a beginner.) I didn't really have to configure it at all, though I would still prefer to use Vim, so help is still much appreciated.

Edit4: running make vimFirst (vimFirst.c is my file) compiles! Running the program with :! vimFirst.exe works as expected. Now returning to the original question, how to do it with C.vim? It would be so much more convinient to type \rc and have the program compile and run, which is about 1/10 of the typing of the other method.


Edit4: running make vimFirst (vimFirst.c is my file) compiles! Running the program with :! vimFirst.exe works as expected. Now returning to the original question, ... type \rc and have the program compile and run...

Check your maps for \rc and \rr:

:map \rc
:map \rr

If no mapping exists, you might have no_plugin_maps or something similar set in your vimrc.

I think you'll get what you want if you set them up like this:

nmap \rc :make %<<CR>
nmap \rr :! %<.exe<CR>

If you're really familiar with Visual Studio and want to use nmake to build your code, you should check out the :compiler option. :compiler msvc will setup your makeprg and errorformat for nmake and Visual Studio's compiler.

I'm not sure what make is currently using to build your code, so I don't know what compiler setting you'd want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜