How Can Be Used the Command Line of Developer Command Prompt in Vim on Windows?

I have Visual Studio Express for Windows Desktop installed on this laptop and I can compile a C++ source file with the command cl /EHsc filename.cpp and a C++ program that uses .NET classes with the command cl /clr filenameclr.cpp on the command line of Developer Command Prompt for VS2012 using this instructions: http://msdn.microsoft.com/en-us/library/ms235639.aspx

How can I be able to compile in Vim (text editor) on Microsoft Windows with those commands? :cl /EHsc filename.cpp and :cl /clr filenameclr.cpp does not work.


You need to setup your PATH , INCLUDE and LIB environment variables.

You could do that by running D:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat (or wherever it is located on your installation) in the same prompt you're running vim, or even manually setting these environment variables (here is a list of all values for VS2008 and Windows SDK: Using Visual Studio's 'cl' from a normal command line).

However, you just can't run the bat file from vim directly, because it will open another Prompt, so the environment variables will be set only for that new prompt. The other option is just to create bat file which you can put it inside your PATH , for example cvim :

call "D:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat"
"C:Program Files (x86)Vimvim74gvim.exe"

After that, typing cvim.bat will get you in the environment ready for running :! cl /EHsc % :! cl /EHsc %

链接地址: http://www.djcxy.com/p/85042.html

上一篇: vc ++中std :: string / std :: wstring的宏是什么?

下一篇: 如何在Windows上使用Vim中开发者命令提示符的命令行?