看板 MacDev 關於我們 聯絡資訊
※ 引述《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
tinmean:這兩個函式庫名稱是不是打錯了啊...雖然我很久沒寫C了... 10/25 14:55
sky22540:兩個應該都要加.h吧 10/25 15:00
sky22540:應該用stdlib.h time.h吧 10/25 15:01
ilovemilk:嗨 大家太厲害了 果然是他寫錯 10/25 15:14
purmac:這真的很天兵 哈 10/26 00:54