使用C编程时出现Flymake配置错误

11 c emacs

当试图在Emacs中运行Mx Flymake-Mode时,我得到:

Flymake: Configuration error has occured while running (make -s -C ./CHK_SOURCES=helloworld_flymake.c SYNTAX_CHECK_MODE=1 check-syntax). Flymake will be switched OFF
Run Code Online (Sandbox Code Playgroud)

我在一个名为helloworld.c的缓冲区中调用该命令:

#include <stdio.h>

int main(void) {
  printf("Hello World");
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

并在同一目录中有一个名为Makefile的文件:

helloworld: helloworld.c
 gcc helloworld.c -o helloworld
Run Code Online (Sandbox Code Playgroud)

我在Ubuntu 9.04下运行GNU Emacs 23.0.91.1.

提前致谢!

小智 19

Makefile' must contain the检查语法'目标.将其附加到Makefile:

check-syntax:
     gcc -o nul -S ${CHK_SOURCES}
Run Code Online (Sandbox Code Playgroud)

确保使用TAB启动第二行.还有一个flymake的错误,你必须使用大写字母M命名Makefile.如果你把它称为"makefile",它将无法工作.小心一点!


180*_*ION 1

这是你的 makefile 的实际内容吗?看起来第二行之前有一个空格“”。这应该是一个选项卡:

helloworld: helloworld.c
 gcc helloworld.c -o helloworld
Run Code Online (Sandbox Code Playgroud)

更多类似这样的:

helloworld: helloworld.c
    gcc helloworld.c -o helloworld
Run Code Online (Sandbox Code Playgroud)

请记住,SO 编辑器似乎已将我的制表符转换为空格,所以不要这样做。

helloworld: helloworld.c
<press tab here>gcc helloworld.c -o helloworld
Run Code Online (Sandbox Code Playgroud)