Re: 爬文還是不行

看板MacDev作者 (呼啦啦..)時間18年前 (2005/10/25 14:16), 編輯推噓4(401)
留言5則, 4人參與, 最新討論串2/2 (看更多)
※ 引述《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

10/25 14:55, , 1F
這兩個函式庫名稱是不是打錯了啊...雖然我很久沒寫C了...
10/25 14:55, 1F

10/25 15:00, , 2F
兩個應該都要加.h吧
10/25 15:00, 2F

10/25 15:01, , 3F
應該用stdlib.h time.h吧
10/25 15:01, 3F

10/25 15:14, , 4F
嗨 大家太厲害了 果然是他寫錯
10/25 15:14, 4F

10/26 00:54, , 5F
這真的很天兵 哈
10/26 00:54, 5F
文章代碼(AID): #13NSsrrq (MacDev)
討論串 (同標題文章)
文章代碼(AID): #13NSsrrq (MacDev)