文章目錄
- 前言
- 一、如何安裝vscode?
- 二、編譯流程
- 1.創建作業區
- 2.C++除錯
前言
用于熟悉llinux下的vs code,以便以后使用,
以下是本篇文章正文內容,參考:B站:鵝彈
一、如何安裝vscode?
參考鏈接:https://blog.csdn.net/ll596214569/article/details/106445990
二、編譯流程
1.創建作業區
代碼如下(在終端輸入):
找到你想放的的檔案夾,終端打開,然后輸入以下代碼,
mkdir EIGEN
code ./EIGEN
得到這個作業空間,

安裝插件:C++

2.C++除錯
創建一個.cpp檔案(注意:檔案型別與檔案名后綴有關),

隨便寫一個C++程式
#include<iostream>
#include<string>
using namespace std;
int main(int argc,char **argv )
{
cout<<"hello ltt"<<endl;
return 0;
}
創建launch.json檔案

環境選取:C++(GDB/LLDB)

然后選擇g++ build and debug active file,得到.json檔案

創建task.json檔案(依次)
1.回到.cpp檔案
2.ctrl+shift+p或F1打開命令欄
3.tasks:Configure Task
4.C/C++:g++ build active file
5.得到下圖所示結果

在tasks.json檔案中加入
"-std=c++17"
位置如下

然后回傳cpp檔案,加入斷點,F5運行,

在launch.json檔案中添加一個選項
"internalConsoleOptions": "neverOpen",
在下圖藍色位置:

回傳發現除錯成功;
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/253027.html
標籤:其他
上一篇:虛擬機橋接模式配置網路
下一篇:Linux磁盤管理
