help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compilation in C and ADA


From: Dale Snell
Subject: Re: Compilation in C and ADA
Date: Sat, 23 Jul 2016 10:52:53 -0700

On Sat, 23 Jul 2016 10:22:22 -0400, in message
address@hidden, Francis Belliveau
wrote:

> 
> If I see a command like "compile" in a menu, I expect it to call the
> compiler for me, not attempt to "make" my project.

But which compiler would that be?  There are lots of different
compilers out there, for lots of different languages.  Emacs is
capable of many things, but it cannot read minds.  You have to
tell it which compiler to use.  It gives you the opportunity to do
when you select "Compile..." from the menu:

    "Compile command: make -k "

appears in the mini-buffer.  Delete the "make -k " and replace it
with whatever command line runs your compiler of choice.  Emacs
will retain this command until it is explicitly changed, or until
you restart Emacs.

You could create a Makefile that will call your compiler, but for
a single file project that's a bit of overkill, IMO.  If you're
going to be repeatedly compiling a single file, you could add
a file-local variable.  For example, put

// -*- mode: compile-command: "compile prognam.c > prognam.o" -*-

in the first line of your program file, substituting whatever
values of compile and prognam you require.  (Replace the leading
"//" with whatever comment delimiter you need.)  That will set the
compile command to whatever you need when the program file is
loaded.  (Note that it won't change if you change the file-local
variable _after_ you've loaded the file.)

I hope this helps.

--Dale

-- 
Pessimist:  The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]