分页: 1 / 1

如何让emacs自动编译?

发表于 : 2010-04-26 12:49
testla
我想按F10键时对当前C源代码进行编译,例如,文件名为XXX.c的源文件怎么写配置文件,使得按F10键后执行这个命令?
gcc -o xxx -g xxx.c

Re: 如何让emacs自动编译?

发表于 : 2010-04-26 16:41
davyzhu
A general method with *nix flavor:
1. write a Makefile in the source directory like

代码: 全选

xxx: xxx.c
    gcc -o xxx -g xxx.c
2. M-x compile (I alias it to M-x cpl, or you can alias it to F10)
M-x compile will (1)run make Makefile, (2)parse the information by gcc and re-fontify it.