Compile within Vim under Win XP ?

classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Compile within Vim under Win XP ?

Tintin72-2

Hi,

I'm deseperatly trying to compile a simple C program within Vim under
Win XP.
I type ":make" as it described in the help file, but it doesn't work.
The error message I get from the shell is:

'make' doesn't recognize as an intern command.....
the shell returned 1
type ENTER to continue

note: This prog compile correctly if I type 'make' directly from the
DOS console

Is there any way to compile within Vim under Win XP or is it
just a feature for the Unix users ?


Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Bill McCarthy

On Sun 22-Jul-07 10:55am -0600, Tintin72 wrote:

> I'm deseperatly trying to compile a simple C program within Vim under
> Win XP.
> I type ":make" as it described in the help file, but it doesn't work.
> The error message I get from the shell is:
>
> 'make' doesn't recognize as an intern command.....
> the shell returned 1
> type ENTER to continue
>
> note: This prog compile correctly if I type 'make' directly from the
> DOS console

If you just type "make" from a command prompt, a make
program will usually execute a make script called something
like "makefile".

Does you buffer contain such a makefile?

> Is there any way to compile within Vim under Win XP or is it
> just a feature for the Unix users ?

No, it works fine under WinXP.  BTW, my normal setting for
makeprg is splint - so I usually run my "makes" on source.

--
Best regards,
Bill


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

scott-268

On Sun, Jul 22, 2007 at 12:36:24PM -0500, Bill McCarthy wrote:

>
> On Sun 22-Jul-07 10:55am -0600, Tintin72 wrote:
>
> > I'm deseperatly trying to compile a simple C program within Vim under
> > Win XP.
> > I type ":make" as it described in the help file, but it doesn't work.
> > The error message I get from the shell is:
> >
> > 'make' doesn't recognize as an intern command.....
> > the shell returned 1
> > type ENTER to continue
> >
> > note: This prog compile correctly if I type 'make' directly from the
> > DOS console
>
> If you just type "make" from a command prompt, a make
> program will usually execute a make script called something
> like "makefile".

if he wants to compile C on XP shouldn't he be running
'nmake'?

sc

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Bill McCarthy

On Sun 22-Jul-07 12:46pm -0600, sc wrote:

> On Sun, Jul 22, 2007 at 12:36:24PM -0500, Bill McCarthy wrote:
>>
>> On Sun 22-Jul-07 10:55am -0600, Tintin72 wrote:
>>
>> > I'm deseperatly trying to compile a simple C program within Vim under
>> > Win XP.
>> > I type ":make" as it described in the help file, but it doesn't work.
>> > The error message I get from the shell is:
>> >
>> > 'make' doesn't recognize as an intern command.....
>> > the shell returned 1
>> > type ENTER to continue
>> >
>> > note: This prog compile correctly if I type 'make' directly from the
>> > DOS console
>>
>> If you just type "make" from a command prompt, a make
>> program will usually execute a make script called something
>> like "makefile".
>
> if he wants to compile C on XP shouldn't he be running
> 'nmake'?

He said 'make' works from the command line.  There are many
make programs available with WinXP.  On my XP machine:

   pad> nmake
   4NT: Unknown command "nmake"

I believe 'nmake' is usually for Microsoft compilers.

--
Best regards,
Bill


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tintin72-2
In reply to this post by scott-268

>Does you buffer contain such a makefile?
Yes

>if he wants to compile C on XP shouldn't he be running
'nmake'?
With 'nmake' I get an 'unknown command' error message.

Any idea ?


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

scott-268

On Sun, Jul 22, 2007 at 11:17:05AM -0700, Tintin72 wrote:
>
> >Does you buffer contain such a makefile?
> Yes
>
> >if he wants to compile C on XP shouldn't he be running
> 'nmake'?
> With 'nmake' I get an 'unknown command' error message.
>
> Any idea ?

well, is any flavor of microsoft visual studio installed, and
have you run the environment script?

you said you wanted to compile a simple c program -- with
what compiler did you intend to accomplish this?

sc

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Mike Mazur

Hi,

> On Sun, Jul 22, 2007 at 11:17:05AM -0700, Tintin72 wrote:
> I type ":make" as it described in the help file, but it doesn't work.

Here's a shot in the dark, but is vim's working directory the same as
the one containing the source? The pwd command should tell you.

Mike

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tintin72-2

>you said you wanted to compile a simple c program -- with
>what compiler did you intend to accomplish this?
I use MinGW compiler (GCC for Windows)

> Here's a shot in the dark, but is vim's working directory the same as
> the one containing the source? The pwd command should tell you.
Yes, Vim is in the right directory.
I use :Explore to navigate in the directories and I type 'c' when Vim
is in the right directory.

However, I found some clues about my pb:
The default location of my prompt is D:\> and when I type :!dir in Vim
(wich is in the right directory), the directory listing remains D:.
I placed the prompt at the right location D:\prog\hello but I still
get the D: directory listing.
So I turned (in regedit) the default prompt location D: into  D:\prog
\hello , and now the compilation works. But it's not very handy if I
have to modified the default prompt location each time I want to
compile a new program.

What's wrong with it ?




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

wangfc

Tintin72 ??:

>> you said you wanted to compile a simple c program -- with
>> what compiler did you intend to accomplish this?
> I use MinGW compiler (GCC for Windows)
>
>> Here's a shot in the dark, but is vim's working directory the same as
>> the one containing the source? The pwd command should tell you.
> Yes, Vim is in the right directory.
> I use :Explore to navigate in the directories and I type 'c' when Vim
> is in the right directory.
>
> However, I found some clues about my pb:
> The default location of my prompt is D:\> and when I type :!dir in Vim
> (wich is in the right directory), the directory listing remains D:.
> I placed the prompt at the right location D:\prog\hello but I still
> get the D: directory listing.
> So I turned (in regedit) the default prompt location D: into  D:\prog
> \hello , and now the compilation works. But it's not very handy if I
> have to modified the default prompt location each time I want to
> compile a new program.
>
> What's wrong with it ?
>
>
>
>
> >
Maybe the following command is usefull.
:cd someotherdir

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tintin72-2

> Maybe the following command is usefull.
> :cd someotherdir- Hide quoted text -

No, ':cd' doesn't help


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

wangfc

Tintin72 write:
>> Maybe the following command is usefull.
>> :cd someotherdir- Hide quoted text -
>
> No, ':cd' doesn't help
>
>
> >
Under you vim, use the command >
:cd d:/proc/helloworld
:make

Then the working directory is d:/proc/hellworld .
So , you can change the working directory to anywhere you want.

You had said :
The default location of my prompt is D:\> and when I type :!dir in Vim
(wich is in the right directory), the directory listing remains D:.
I placed the prompt at the right location D:\prog\hello but I still
get the D: directory listing.
So I turned (in regedit) the default prompt location D: into  D:\prog
\hello , and now the compilation works. But it's not very handy if I
have to modified the default prompt location each time I want to
compile a new program.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tony Mechelynck
In reply to this post by Tintin72-2

Tintin72 wrote:

>> you said you wanted to compile a simple c program -- with
>> what compiler did you intend to accomplish this?
> I use MinGW compiler (GCC for Windows)
>
>> Here's a shot in the dark, but is vim's working directory the same as
>> the one containing the source? The pwd command should tell you.
> Yes, Vim is in the right directory.
> I use :Explore to navigate in the directories and I type 'c' when Vim
> is in the right directory.
>
> However, I found some clues about my pb:
> The default location of my prompt is D:\> and when I type :!dir in Vim
> (wich is in the right directory), the directory listing remains D:.
> I placed the prompt at the right location D:\prog\hello but I still
> get the D: directory listing.
> So I turned (in regedit) the default prompt location D: into  D:\prog
> \hello , and now the compilation works. But it's not very handy if I
> have to modified the default prompt location each time I want to
> compile a new program.
>
> What's wrong with it ?

Netrw (or :Explore) usually don't make the browsed directory current -- unless
you explicitly use

        :let g:netrw_keepdir = 0

(see ":help g:netrw_keepdir"). By default, the current directory will not
change unless you issue an explicit ":cd" command with an argument (WARNING:
:cd with no argument means "tell me which directory is current" under Windows
and "change to the home directory" under Unix.)


Best regards,
Tony.
--
Consultants are mystical people who ask a company for a number and then
give it back to them.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tintin72-2

I tried
:let g:netrw_keepdir=0
but pb is still the same

Anyway, I just can't understand that when I type 'c' or I use the
':cd' or the ':pwd' command, Vim displayed the right path directory (D:
\prog\hello) , so why 'make' doesn't work ?


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Gary Johnson

On 2007-07-22, Tintin72 <[hidden email]> wrote:

> Hi,
>
> I'm deseperatly trying to compile a simple C program within Vim under
> Win XP.
> I type ":make" as it described in the help file, but it doesn't work.
> The error message I get from the shell is:
>
> 'make' doesn't recognize as an intern command.....
> the shell returned 1
> type ENTER to continue
>
> note: This prog compile correctly if I type 'make' directly from the
> DOS console

On 2007-07-23, Tintin72 <[hidden email]> wrote:
> I tried
> :let g:netrw_keepdir=0
> but pb is still the same
>
> Anyway, I just can't understand that when I type 'c' or I use the
> ':cd' or the ':pwd' command, Vim displayed the right path directory (D:
> \prog\hello) , so why 'make' doesn't work ?

I don't understand what's going on here, either, but I suspect some
difference in your environment when you execute 'make' from within
vim vs. when you execute 'make' at the DOS prompt, so here are some
experiments you can try to determine what this difference is.

First of all, to get an idea of what you were seeing, I fired up vim
from my Quick Launch toolbar.  Then I executed

   :make

and got this:

   :!make  >C:\DOCUME~1\garyjohn\LOCALS~1\Temp\VIe4B6E.tmp 2>&1
   shell returned 1
   (1 of 2): 'make' is not recognized as an internal or external command,
   Press ENTER or type command to continue

I believe this is the same result that you got.  In my case, I
expected it since I don't have any 'make' program in my Windows
Path.  I get the same result if I execute 'make' at the DOS prompt:

   C:\Documents and Settings\garyjohn>make
   'make' is not recognized as an internal or external command,
   operable program or batch file.

So it appears that your shell (cmd.exe) is not finding your 'make'
in the Path it receives from vim when you execute ":make".

Now to the experiments you can try.  To see for sure what directory
vim is trying to run 'make' in, set this in vim:

   :set makeprg=cd

and execute

   :make

In my case, I got this:

   :!cd  >C:\DOCUME~1\garyjohn\LOCALS~1\Temp\VIe4B71.tmp 2>&1
   (1 of 1): C:\Documents and Settings\garyjohn

Another experiment would be to execute these:

   :set makeprg=set
   :set nomore
   :redir @a
   :make
   :clist
   :redir END
   :set more

and then paste register a someplace.  That is the environment that
the shell sees when lauched from vim.  You might be able to spot
something in this environment, especially something in Path, that
doesn't look right.  You could also capture the output of the 'set'
command executed in a DOS window into a file, e.g.,

   >C: set > set.txt

and diff this file with the 'set' output you captured above.  When I
tried this, I did find some differences between the two
environments.  I don't know whether all vims modify the environment
or this is the result of my configuration, but for the current
purposes, it doesn't really matter.  What matters is what, if any,
differences are in your environments.

In any case, for me, the environment that vim created included these
elements that were missing from the environment at the DOS prompt.

   HOME=C:\Documents and Settings\garyjohn
   MYVIMRC=C:\Documents and Settings\garyjohn\.vimrc
   VIM=C:\Program Files\Vim
   VIMRUNTIME=C:\Program Files\Vim\vim71

and Path had this appended:

   ;C:\Program Files\Vim\vim71

HTH,
Gary

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tintin72-2

Thank you guys for your help.

Actually the thing is that in MinGW the executable 'make' calls
mingw32-make.exe
and not make.exe.
If it works directly from the prompt it's because I use a make.bat
file wich
contains the path c:\mingw\bin\mingw32-make.exe , but it seems that
Vim doesn't
care about this .bat file.
So I renamed mingw32-make.exe to make.exe and now 'make' seems to be
recognized
in Vim but it display this error message:

make: *** No targets specified and no makefile found.

Obviously that's wrong, and if I launch 'make' directly from the
prompt it works.

Any idea ?


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tony Mechelynck

Tintin72 wrote:

> Thank you guys for your help.
>
> Actually the thing is that in MinGW the executable 'make' calls
> mingw32-make.exe
> and not make.exe.
> If it works directly from the prompt it's because I use a make.bat
> file wich
> contains the path c:\mingw\bin\mingw32-make.exe , but it seems that
> Vim doesn't
> care about this .bat file.
> So I renamed mingw32-make.exe to make.exe and now 'make' seems to be
> recognized
> in Vim but it display this error message:
>
> make: *** No targets specified and no makefile found.
>
> Obviously that's wrong, and if I launch 'make' directly from the
> prompt it works.
>
> Any idea ?

Rename "make.exe" back, then try

        :set makeprg=make.bat

and, if  it doesn't work,

        :set makeprg=cmd\ /C\ make.bat


Best regards,
Tony.
--
"I appreciate the fact that this draft was done in haste, but some of
the sentences that you are sending out in the world to do your work for
you are loitering in taverns or asleep beside the highway."
                -- Dr. Dwight Van de Vate, Professor of Philosophy,
                   University of Tennessee at Knoxville

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tintin72-2

It still doesn't work :-(

>         :set makeprg=make.bat
make.bat is not recognized as an internal command

>         :set makeprg=cmd\ /C\ make.bat
cmd\ is not recognized as an internal command


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Gary Johnson

On 2007-07-23, Tintin72 <[hidden email]> wrote:
> It still doesn't work :-(
>
> >         :set makeprg=make.bat
> make.bat is not recognized as an internal command
>
> >         :set makeprg=cmd\ /C\ make.bat
> cmd\ is not recognized as an internal command

There seems to be something very wrong with your setup.  When I try
the above (and I have no make.bat file), I get these results:

   :set makeprg=make.bat
   :make
   :!make.bat  >C:\DOCUME~1\garyjohn\LOCALS~1\Temp\VIe4B89.tmp 2>&1
   shell returned 1
   (1 of 2): 'make.bat' is not recognized as an internal or external command,

   :set makeprg=cmd\ /C\ make.bat
   :make
   :!cmd /C make.bat  >C:\DOCUME~1\garyjohn\LOCALS~1\Temp\VIe4B8A.tmp 2>&1
   shell returned 1
   (1 of 2): 'make.bat' is not recognized as an internal or external command,

Note that in each case above, I typed the first two lines and vim
responded with the second through fifth lines.

I don't know why or how you would get "cmd\ is not recognized as an
internal command".  I haven't thought very deeply about it.  It
seems like it could be a shell quoting problem.

Try running vim from the DOS prompt as

   C:> vim -u NONE

or gvim from the Start -> Run dialog as

   gvim -u NONE

and see if you get the same results.  (When running from the Run
dialog, you may have to enter the full path name to your gvim
executable if it isn't in your Path.)

HTH,
Gary

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tony Mechelynck
In reply to this post by Tintin72-2

Tintin72 wrote:
> It still doesn't work :-(
>
>>         :set makeprg=make.bat
> make.bat is not recognized as an internal command
>
>>         :set makeprg=cmd\ /C\ make.bat
> cmd\ is not recognized as an internal command

I'm talking of Vim ":set", not cmd.exe SET

The backslash is there to escape the space. Using

     :set makeprg=cmd\ /C\ make.bat

in Vim, not at the cmd.exe prompt, sets up the Vim 'makeprg' option to the value

        cmd /C make.bat

and "cmd", when invoked as a program, should load cmd.exe, your Windows shell.


Best regards,
Tony.
--
Weiner's Law of Libraries:
        There are no answers, only cross references.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Compile within Vim under Win XP ?

Tintin72-2

> I'm talking of Vim ":set", not cmd.exe SET
I know. I typed all the commands in Vim, not in the DOS console.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


12