vs的c++环境配置

在ubuntu中 配置vscode 的 C++ 环境

安装C++环境

  • sudo apt install gcc
  • sudo apt install g++

配置vscode

  • 点击左侧齿轮按纽,点击弹出窗口的齿轮按钮添加环境

  • 然后点击设置会生成一个后缀为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}/${fileBasenameNoExtension}.out",  
              "args": [],  
              "stopAtEntry": true,  
              "cwd": "${workspaceFolder}",  
              "environment": [],  
              "externalConsole": false,  
              "MIMode": "gdb",  
              "preLaunchTask": "build",  
              "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": "build",  
                  "type": "shell",  
                  "command": "g++",  
                  "args": ["-g", "${file}", "-std=c++11", "-o", "${fileBasenameNoExtension}.out"]  
              }  
          ]  
      }  

这就配置好了,按f5就可以调试了


   转载规则


《vs的c++环境配置》 ZS 采用 知识共享署名 4.0 国际许可协议 进行许可。
 上一篇
TCP的三次握手 TCP的三次握手
TCP三次握手TCP/IP协议简介TCP/IP协议是一个协议族,里面包括了IP协议,IMCP协议,TCP协议,以及我们更加熟悉的http、ftp、pop3协议等等,这些协议类似于国际语言,大家在交流时同一使用的语言。 TCP/IP协议的
2019-06-29
下一篇 
线程全局变量ThreadLocal 线程全局变量ThreadLocal
线程内的全局变量-ThreadLocal 对于每个线程获取变量值时, 只能使用函数进行传值,但对于多级函数,传参比较麻烦 ThreadLocal解决方案 import threading # 创建全局ThreadLo
2019-05-13
  目录