Chinaunix首页 | 论坛 | 博客
  • 博客访问: 151926
  • 博文数量: 34
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 346
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-19 09:53
文章分类

全部博文(34)

文章存档

2011年(1)

2009年(33)

我的朋友

分类: LINUX

2009-05-31 14:56:14

今天在编译程序时碰到该问题:
whetstone.c:(.text+0x56c): undefined reference to `sin'
whetstone.c:(.text+0x585): undefined reference to `cos'
whetstone.c:(.text+0x5cf): undefined reference to `atan'
检查头文件math.h已经包含,原来虽然程序中已经包含math.h,但在链接时要链接到数学库,加上-lm编译选项即可,如下:
将 gcc whetstone.c -o whetstone   改为 gcc whetstone.c -lm -o whetstone即可。
阅读(1175) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~