- 论坛徽章:
- 0
|
qw1.c是那个把余弦曲线打印在屏幕上的程序,但是链接时似乎找不到math.h里面的acos()函数?谁能告诉我这是怎么回事呢?
- imonyse@ubuntu:~/test$ cat qw1.c
- #include <stdio.h>
- #include <math.h>
- main()
- {
- double y;
- int x,m;
- for (y=1;y>=-1;y-=0.1)
- {
- m=acos(y)*10;
- for (x=1;x<m;x++)
- printf(" ");
- printf("*");
- for (;x<62-m;x++)
- printf(" ");
- printf("*\n");
- }
- }
- imonyse@ubuntu:~/test$ cc qw1.c
- /tmp/ccAhwEtn.o: In function `main':
- qw1.c:(.text+0x22): undefined reference to `acos'
- collect2: ld 返回 1
- imonyse@ubuntu:~/test$
复制代码
[ 本帖最后由 imonyse 于 2007-4-29 07:34 编辑 ] |
|