在vscode命令列中編譯執行C 11程式

2021-10-23 00:11:30 字數 698 閱讀 3565

編譯:g++ -s test.cpp(g++ -s僅編譯程式),執行該命令後生成.s檔案(彙編**)

彙編:g++ -c test.cpp (g++ -c 包含編譯過程和彙編過程) 執行該命令後生成.o檔案

編譯預處理:將.cpp檔案轉化成.i檔案,g++

-e (preprocess only;

donot compile, assemble or link)

編譯:將.cpp/

.**件轉化成.s檔案,g++

-s ( compile only;

donot assemble or link)

彙編:將.s檔案轉化成.o檔案,g++

-c (compile and assemble, but do

not link)

-o place the output into

1.編譯命令

編譯.cpp檔案生成可執行檔案, 同時使用c++11編譯,不註明預設使用c++98

g++ test.cpp -o test.exe -std=c++11

2.執行可執行程式

test.exe

參考鏈結

在Windows命令列中編譯執行C C 程式

此處執行環境是在windos下,執行cmd命令進入dos介面 現在有一段簡單c 檔名為 demo.cpp 用於計算a b的值 includeusing namespace std int main int a,b while cin a b cout 第一步 在dos介面進入這個目錄 第二步 用g ...

vscode命令列呼叫

對於經常使用macos terminal的使用者來說,希望直接命令呼叫vscode軟體開啟檔案或資料夾,我們只需如下操作即可 shift command p搜尋 shell 安裝好之後系統就可以使用code folder or file直接開啟檔案或資料夾了 當前已經開啟的終端,關閉重開 as4k ...

C語言 在命令列編譯執行程式

開始 1.在mac和linux上寫c語言之前,首先要看看是否安裝了編譯器 在終端下輸入gcc後回車進行檢測,如果安裝過,將提示 clang error no input files 沒有輸入檔案 在centos下直接yum y install gcc gcc c y表示將自動選擇y 2.現在開始愉快...