0

Whenever I use the :!make % command, vim returns "make is not recognized as an internal or external command, operable program, or batch file." I have tried set makrprg=\"C:\\Program\ Files\ (x86)\\Microsoft\ Visual\ Studio\ 14.0\\VC\\bin\\cl.exe\". However, the same message appears. I believe the error may be in the path I have set, or the format of my statement; however, I am not sure if there is any other underlying cause.

I would greatly appreciate any input. Thanks in advance!

FYI:

I use a Windows 8 computer, and the compiler I typically use is the Microsoft Visual Studio 14.0 compiler.

3 Answers 3

2

! is a VIM command that invokes the shell. !make tells the shell to run whatever the shell can fund under the name make. If you want to use VIM's makeprg, you need to use the VIM command :make.

Having said that, setting makeprg to sonething that is not a real make-style program is probably going to work only in the very simplest scenario.

You can run the compiler directly with !cl %. You need to put cl.exe in your PATH and probably set up other environment so that cl can find libraries and include files.

Sign up to request clarification or add additional context in comments.

1 Comment

Typically, when I compile programs in Visual Studio compiler, I use the command cl [file], so that makes sense. I tried it previously but cl was not recognized as an internal or external command, likely due to the fact that the path to the compiler was not defined yet. However, I'm still new to Vim, so I'm not sure how to go about adding the compiler to my PATH and setting up the environment.
0

This is because you do not have the make executable installed, which is what vim is looking for. If you're looking to compile on the command line with make, I would recommend switching from the Visual Studio compiler to MinGW

Comments

0

make is a Unix tool, and while it is also available for Windows (in various flavors, native, Cygwin, or MinGW), it is usually not what you will be using together with MS Visual Studio.

It is difficult to be specific, since you told us nothing about the project you are trying to compile, but I will try.

If your project is set up as a Visual Studio solution, you can compile it using devenv:

devenv /build release mysolution.sln
devenv /build release /project mysolution/myproject/myproject.vcxproj

Your project might also be set up for NMake (which is a make-like tool shipping with MSVC):

nmake [target]

The two commands above require the current shell to be properly set up, which can be achieved by starting a "Visual Studio Command Line" from the start menu, or running %VS120COMNTOOLS%\..\..\VC\vcvarsall.bat from whatever shell you happen to work from. (Adjust VS120COMNTOOLS to whatever version of MSVC you are using.)

Or your project might actually be set up using "real" makefiles, in which case I second Levi: It seems like make is not installed, or has not been added to your PATH environment variable.

make [target]

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.