unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Compilator en windows
Date: Wed, 19 Sep 2012 18:15:59 +0200	[thread overview]
Message-ID: <878vc6f0ow.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: mailman.9307.1348070151.855.help-gnu-emacs@gnu.org

Jose Cristino Cepeda Uceta <cristiamuz@hotmail.com> writes:

> i am new to emacs. I install emacs on windows and I want to configure
> it to work with the MinGW compiler but not how

Compiling from emacs, is usually done with M-x compile RET
By default, it runs the make command.

So you'd write a Makefile with rules to call the MinGW compiler.

Writing Makefile doesn't concern emacs (emacs just provides an editing
mode for Makefiles, with nice colorization).  So read the documentation of
your make program.

Calling the MinGW compiler doesn't concern emacs (emacs just provides a
compile mode to launch a compiler, and to analyse error messages).  So
read the documentation of your MinGW compiler.


I know the usual unix or GNU make, but often on MS-Windows people use
another make, with I guess a different syntax.  The principle would be
the same.  On unix you'd write a Makefile like this:

----(Makefile)----------------------------------------------------------

# variables: specific to the compilation of a specific program

EXE=mypgm
OBJ=mymodule.o mypgm.o
INCS=-I.
LIBS=-lm

# CC is usually predefined by make; but you can also define it to point
# to a specific compiler; you'd put the path to the MinGW compiler here.

CC=gcc


# rules: always about the same.

all:$(EXE)

$(EXE):$(OBJ)
    $(CC) -o $@ $< $(LIBS)

.o.c: ; $(CC) -c $(INCS) -o $@ $<

# dependencies: depend on the specific program; can also be generated
# automatically from the sources.

mymodule.o : mymodule.h mymodule.c
mypgm.o    : mymodule.h mypgm.c

------------------------------------------------------------------------


If you have a simple single source file program, you can also often
compile it just calling the compiler, without a Makefile.  Then you can
edit the command line proposed by M-x compile to call directly the
compiler:


    M-x compile RET C-a C-k   gcc -o mypgm *.c -lm    RET
                              ^^^^^^^^^^^^^^^^^^^^

Having read the documentation of the MinGW compiler, you would
substitute the part underlined by "^^^^" with the right MinGW compiler
invocation.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


       reply	other threads:[~2012-09-19 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.9307.1348070151.855.help-gnu-emacs@gnu.org>
2012-09-19 16:15 ` Pascal J. Bourguignon [this message]
2012-09-19 11:50 Compilator en windows Jose Cristino Cepeda Uceta
2012-09-19 16:36 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vc6f0ow.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).