Judge Maygardenβs decision was right until he left and the Vim problem I had, but there were a few other issues that I had to solve to get everything working. In particular,
cl.exe requires the correct environment as well as the correct path; that is, adding C:\my\path\to\cl not sufficient. Otherwise, you will receive an error message without DLL s. The solution is to run vcvars32.bat (or any other batch file that installs a similar environment) and cl as one command.
cmd requires that any paths with spaces be double, but you cannot escape them with \ , because :! ... :! ... processes \ literally; instead, you must double-quote the double quote, ""...
So, for completeness, I thought I would post my actual solution. In Vim (or _vimrc ):
:set makeprg=\"\"Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 10.0\\VC\\bin\\vcvars32.bat\"\&\&cl\"
and then you can just call
:make %
and you're done.
This method is easily generalized to any compiler. Also, as devemouse's answer suggests, creating a makefile for nmake is probably the best way to do something for any non-trivial project (I wanted the Vim-only solution to fit my current job).
gvkv
source share