看板 Linux 關於我們 聯絡資訊
//---------以下是程式碼:--------------------- #include <stdio.h> int main() { printf("Hello World\n"); exit(0); } //-------------------------------------------- 我下了這個指令 $gcc -c hello.c 卻產生錯誤訊息 hello.c: 在函式 「main」 中: hello.c:6: 警告: 隱含宣告與內建函式 「exit」 不相容 請問該怎麼解決呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.4.196
chadjye:include stdlib 07/06 18:25
chadjye:或是改用return別用exit 07/06 18:26
CrBoy:因為exit()是宣告在stdlib.h當中的 07/06 21:32
closedpath:謝謝,那請問exit(0),和return 0的意思是一樣的嗎? 07/06 22:04
Zozfee:在這種情況下,exit(0) 和 return 0 意思是一樣的 07/06 22:16