C ++のコードを書くためにどのようにUbuntuのVscode
(A)のダウンロードVscode
(1)オープンUbuntuのソフトウェア
(2)Vscode、ダウンロードして実行を検索します。
(B)Cをインストール++
(1)。をクリックして、右側のリストを参照してください下
(2)。私たちは、その後の検索やC ++だけでなく、ダウンロード C ++インテリセンス(自動補完を)
(C)の構成
(1)私たちは、ディレクトリを選択し、歓迎の画面に戻ります(フォルダを開きます)
(2)当社は、cppのファイルを作成し、001.cpp命名
(3)F5キーを押し、その後、C ++を選択
(4)これがポップアップ表示されますlaunch.json
(5)私たちは、この文を修正しました
" プログラム":" 例の$ {} workspaceFolder /a.outため、プログラム名を入力します"、
削除
、プログラム名を入力します。例えば
(6)が閉じlaunch.jsonは、我々は001.cppを返しました。
私たちは、Ctrlキー+ Shiftキー+ Bを押す(7)、そして、我々はポイントしダウン、ポップアップ表示その他の最後の点を
(8)次に、ポップtasks.jsonに、我々は、コマンド入力を変更します。
"command": "echo Hello"
修改为:
"command": "g++ -g -o a.out ${file}"
(9) 然后我们就可以关闭 返回001.cpp了。
(10) 我们按下 Ctrl + Shift + B 编译文件 然后再按下F5运行程序.
最后附上完好的
launch.json
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/a.out", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }
tasks.json
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "echo", "type": "shell", "command": "g++ -g -o a.out ${file}", "group": { "kind": "build", "isDefault": true } } ] }