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

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

Re: Compilator en windows


From: Pascal J. Bourguignon
Subject: Re: Compilator en windows
Date: Wed, 19 Sep 2012 18:15:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

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 via email to

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