Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-04-2007, 10:32 PM   #1
LQ Newbie
Registered: Jul 2007
Posts: 0

Rep: Reputation: 0
Compiling in Vim with other directories

I'm just starting to experiment with writing, editing, and compiling programs.

I have c source code and a simple Makefile in a subdirectory of my home directory.

When trying to compile inside of Vim, I noticed it only will look at Makefile in my home (~) directory.

How can I have VIM execute a make in another directory or subdirectory?

Also, do I always need a Makefile to compile using VIM? My program is very short and simple. Is there any other way to do a gcc compilation in VIM, or should I just accept the fact that every time I write code and want to compile it in VIM, I need a Makefile...?

Thanks for any help.
Old 07-06-2007, 01:12 AM   #2
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83

Rep: Reputation: 15
This is more a vim question and you might get better ideas asking on a vim mailing list and/or forum. That said... you may want to try :cd <some_other_directory> before running :make. Alternatively, if you have simple compilation needs and don't need a Makefile, you can try executing a shell command from vim, :!gcc yourfile.c


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling c in vim mohtasham1983 Programming 5 02-11-2007 06:47 AM
About adding PATH directories and maping in vim SW-ANIKY Linux - Newbie 13 12-13-2006 02:40 PM
LXer: Cream for Vim - Making Vim more user friendly LXer Syndicated Linux News 0 06-18-2006 12:54 AM
compiling using javac in vim on windows mineshvarmas Programming 1 01-21-2006 12:54 AM
error when compiling vim 6.1 in BLFS NeoAnderson Linux From Scratch 0 06-09-2003 07:39 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration