C程式在Ubuntu下建立執行

2021-08-09 20:08:44 字數 614 閱讀 6921

1.準備工作

1.1 開啟控制台:使用快捷鍵 ctrl + alt + t;

安裝vim:輸入 sudo apt-get install vim;

安裝gcc:輸入 sudo apt-get install g++。

2.編寫hello.c源**

2 新建檔名為hello.c的原始檔:輸入vim hello.c;

鍵入i 進入insert模式(即編輯輸入模式),寫入如下經典**:

//the first program hello.c

#include

int main(void)

輸入完成後,esc 回到normal模式,

然後這時,我們輸入「冒號」,即":"(不需雙引號),在下方會出現冒號,等待輸入命令,我輸入的是wq。。

w:write,寫入

q:quit,退出

再回車,就儲存退出了

3.編譯hello.c

在終端執行  g++ hello.c -o hello 編譯。

依賴庫編譯,例如:g++ first.c -lcurl -o 1

4.執行程式hello

./hello 就看到結果:

hello,world!

在ubuntu建立 儲存 執行c 檔案

自從上了 c 程式設計課後,我的三觀塌了,因為 only your friends can touch your private,neither your parents nor your children.開啟終端,輸入以下命令,建立乙個空的.cpp檔案 touch main.cpp gedit ...

在ubuntu下執行APIMonitor

執行droidbox的時候沒有調出日誌,感覺很多都是看不懂的 然後轉戰apimonitor 在執行apimonitor.py的時候出現無法注入資訊的問題 第一句大致是apimonitor.py 忘了具體的了 file usr lib64 python2.7 subprocess.py line 52...

在linux下編譯執行C 程式

頭一回。把windows下的程式挪到linux下,見這篇隨筆 1 編譯zthread,使用.configure失敗,直接編譯的,方法還是上面提到的那篇隨筆 2 編譯原始碼,最開始用的cc,後來老是報undefined reference,甚至hello world程式也報undefined refe...