作者ilovemilk (呼啦啦..)
看板MacDev
标题Re: 爬文还是不行
时间Tue Oct 25 14:18:07 2005
※ 引述《ilovemilk (呼啦啦..)》之铭言:
: 标题: 爬文还是不行
: 时间: Tue Oct 25 12:05:26 2005
:
: 帮朋友问
:
: #include <stdio.h>
: #include <stdlib>
: #include <time/h>
:
: int main()
: {
: srand( time( NULL ) );
: double test;
: test = rand();
: printf( "test = %f", test );
:
: return 0;
: }
:
: 我把上面这样的指令存成 test.c 在桌面
: 要如何用终端机来让他执行呢
:
: 用 gcc -o test ~/desktop/test.c 也不行
:
: 请问有方法吗 谢谢
:
: --
:
※ 发信站: 批踢踢实业坊(ptt.cc)
: ◆ From: 140.112.4.247
: 推 Blueshiva:gcc -o test ~/Desktop/test.c 10/25 12:08
照用了
/Desktop/test.c:2:18: error: stdlib: No such file or directory
/Desktop/test.c:3:18: error: time/h: No such file or directory
出现这样的错误讯息
是因为抓不到函式库吗
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.52.186
1F:推 tinmean:这两个函式库名称是不是打错了啊...虽然我很久没写C了... 10/25 14:55
2F:推 sky22540:两个应该都要加.h吧 10/25 15:00
3F:→ sky22540:应该用stdlib.h time.h吧 10/25 15:01
4F:推 ilovemilk:嗨 大家太厉害了 果然是他写错 10/25 15:14
5F:推 purmac:这真的很天兵 哈 10/26 00:54