views:

614

answers:

3

Hi all, I am under a Unix environment, working in C++. I'm opening gvim from a directory in which a makefile called "Makefile" exists. When I try to use ":make" from within vim, I get:

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

+1  A: 

G'day,

Obvious question, does the Makefile in the current directory work when you enter make on the command line?

Trying to seperate out the make in gvim land from the make env. on the command line.

Also, has makeprg been set to something unexpected? What do you get when you enter:

:set makeprg?

BTW The trailing question mark is necessary.

Edit:

  • Do you get different behaviour if you enter:

    :cd the/dir/i/need/to be/in

and then enter

:make

  • Is gvim aliased to anything?

HTH

cheers,

Rob Wells
"make" works in the command line.makeprg=make
Amir Rachum
And you're entering simply make and not gmake?
Rob Wells
I'm only using make, in both gvim and command line.
Amir Rachum
+4  A: 

Do you have autochdir enabled? That may change to another directory.

Check with :pwd to see if the current directory is what you expect.

Try running :!ls to see if the Makefile exists.

rq
Both the C++ file and the Makefile are in the same dir.:pwd gives the directory I'm in (where the Makefile is):!ls gives me ls of my home directory (???)
Amir Rachum
:pwd shows the directory that :! runs from. There may be something very odd in your .vimrc file or a plugin that is masking the correct behaviour. Try running gvim with the --noplugin option to narrow it down.
rq
+2  A: 

Can you check the following options?

:set shell?
:set shelltype?

Finally, check the contents of your shell login file. For example, if your shell is bash, check ~/.bashrc. Does this file contain something like the following?

cd ~

Or:

cd /home/${USERNAME}

where ${USERNAME} is (obviously) your username.

Al
Maybe check ~/.bash_profile or ~/.profile as well.
Rob Wells
Ok, this somewhat helped!Now it's in the correct directory and running my Makefile, but doing make under different library setup. Unfortunately, I'm working on a computer in my firm so I can't really share my .cshrc file as it contains maybe-classified information. I'll try solving the rest on my own.Thank you and thanks to all those who answered!
Amir Rachum
I wonder what the problem was? Does csh read .cshrc even for non-interactive sessions (csh is awful, so it probably does).
rq