linux下編譯執行的第乙個C

2021-08-24 21:38:36 字數 566 閱讀 3271

linux下執行的第乙個c程式

root@localhost root]# vi hello.c

進入vim的命令模式,按下鍵盤的i切換到插入模式,輸入如下**:

#include

int main()

按下esc進入命令模式,輸入:wq,自然會儲存檔案會退回到終端

接下來就是預處理、鏈結、編譯、執行拉

[root@localhost root]# gcc -e hello.c -o hello.i //預處理

[root@localhost root]# gcc -s hello.i -o hello.s //編譯不彙編,生成彙編檔案

[root@localhost root]# gcc -c hello.s -o hello.o //編譯不鏈結。生成目標檔案

[root@localhost root]# gcc hello.o -o hello //生成執行檔案

[root@localhost root]# ./hello //執行執行檔案

hello! this is our embeded world! //這就是輸出的結果

linux下編譯執行的第乙個C

linux下執行的第乙個c程式 root localhost root vi hello.c進入vim的命令模式,按下鍵盤的i切換到插入模式,輸入如下 include int main 按下esc進入命令模式,輸入 wq,自然會儲存檔案會退回到終端 接下來就是預處理 鏈結 編譯 執行 root lo...

linux下的第乙個驅動

前段時間忙著學python語言,其實,學得不咋滴 從習慣的底層程式設計換到上層程式設計,不用考慮記憶體的東西,還不用申請變數,總感覺不太習慣,相信久了就會好了,不過已經基本可以看懂程式了,語言確實簡單。留著以後慢慢琢磨吧。現在需要學習linux下的驅動了,一直都想學,上學期學習迷茫期中,有個機會去廣...

linux第乙個驅動模組編譯

我們的源程式是乙個簡單的程式 include include module license dual bsd gpl static int hello init void static void hello exit void module init hello init module exit h...