linux配置vscodec运行环境,Linux 下 VSCode c/c++环境配置
8種機械鍵盤軸體對比
本人程序員,要買一個寫代碼的鍵盤,請問紅軸和茶軸怎么選?
切換中文
安裝完成的VSCode是英文的,作為一個英文不好的中國人,我還是喜歡看中文的接口。
點擊左側的
會進入擴展商店
拓展商店中直接搜索Chinese 然后點擊Install就行
安裝完成后重啟應用就會變成中文接口。
安裝插件
Code Runner
安裝完成后窗口菜單欄下面就會出來一個
當你的顯示頁面是一個進程源文檔(單個文檔,不是項目)時,點擊這個按鈕或者按ctrl+F5就可以直接運行這個進程,方便快捷。
點擊齒輪,點擊配置,然后把右側的Run In Terminal勾上,就會在控制面板顯示運行結果
c/c++
必裝的插件。
C++ Intellisense
C++的只能提示工具
C/C++ Clang Command Adapter
提供靜態(tài)檢測(Lint)
配置環(huán)境
主要是連個json文檔
launch.json
點擊調(diào)試,然后選擇添加配置。會自動生成lanunch.json文檔
這是我的配置,可以直接復制過去
要注意的就是
"program": "${workspaceFolder}/hello.out", //當前目錄下編譯后的可執(zhí)行文檔"build"`1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32這里的hello.out應該是你生成的執(zhí)行文檔,而build 應該是你的tasks的lable
```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": "debug cpp", //名稱
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/hello.out", //當前目錄下編譯后的可執(zhí)行文檔
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}", //表示當前目錄
"environment": [],
"externalConsole": false, // 在vscode自帶的終端中運行,不打開外部終端
"MIMode": "gdb", //用gdb來debug
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build" //執(zhí)行l(wèi)anuch之前運行的task
}
]
}
tasks.json
按住ctrl+shift+p
輸入tasks,選擇configure Task
選擇使用模板創(chuàng)建然后選others
就會生成tasks.json文檔
仍舊可以直接拷貝
參數(shù)應該是自己的,多個文檔編譯,和在bash中寫一樣,也可以用makefile1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build", // task的名字
"type": "shell",
"command": "g++", //編譯命令
"args": [ //編譯參數(shù)列表
"hello.cpp",
"-o",
"hello.out"
]
}
]
}
c_cpp_properties.json
ctrl+shift+p 輸入c/c++:Edit Configurations 選擇這一項就可以創(chuàng)建一個c_cpp_properties.json文檔
不用改動,我也貼出來我的配置1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
如果有自己的外鏈庫也是添加到這里面。
總結
以上是生活随笔為你收集整理的linux配置vscodec运行环境,Linux 下 VSCode c/c++环境配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决sublime text无法安装插件
- 下一篇: linux chromebook arm