找回密码
 注册
查看: 590|回复: 2

在Magiclinux下,怎么用特殊函数?

[复制链接]
发表于 2005-4-21 02:04:52 | 显示全部楼层 |阅读模式
我想用Linux下的c编程进行科学计算,但是不认sin(x) cos(x) 和sqrt(x)函数?我已经用了头文件#include "math.h".


/tmp/ccRBKYVO.o: In function `main':
/tmp/ccRBKYVO.o(.text+0xb2): undefined reference to `sin'
collect2: ld returned 1 exit status
发表于 2005-4-21 12:23:33 | 显示全部楼层
编译的时候要连接数学库例如:
gcc -Wall -o test -lm test.c
-lm的意思是连接libm.so动态数学库
回复

使用道具 举报

 楼主| 发表于 2005-4-21 14:09:22 | 显示全部楼层
3x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-2-9 00:14 , Processed in 0.027275 second(s), 15 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

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