LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 908|回复: 3

问个emacs编程的基本问题

[复制链接]
发表于 2004-4-15 17:47:00 | 显示全部楼层 |阅读模式
刚用linux,
在emacs中test.c
#include <stdio.h>
#include <math.h>
main()
{
double a;
a=sqrt(4);
printf("a=%f\n",a);
}
保存后
在命令提示下:gcc test.c
            ./a.out
结果出来/tmp/ccA3Kzod.o(.text+0x1b): In function `main':
: undefined reference to `sqrt'
collect2: ld returned 1 exit status
是不是我的include路径要在emacs里面设定.想TC一样.不知道怎么设定?
谢谢
发表于 2004-4-15 18:47:08 | 显示全部楼层
gcc test.c -lm

-lm 表示连接 math 库

不知道如何设置EMACS让它自动连接 MATH库,请大家指点
发表于 2004-4-15 20:55:01 | 显示全部楼层
有这个必要吗??都是在MAKEFILE里
发表于 2004-4-15 22:14:59 | 显示全部楼层
嗯,写个 Makefile
在 Emacs 里 M-x compile
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表