VSCode使用

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录


前言

提示:这里可以添加本文要记录的大概内容:

例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。


提示:以下是本篇文章正文内容,下面案例可供参考

一、初始

1.1安装

下载链接:Download Visual Studio Code - Mac, Linux, Windows

下载支持win7的版本,下载链接:Visual Studio Code July 2022

安装弹出下图,点确定

安装中

安装完成

参考:

【C语言初级阶段学习1】使用vscode运行C语言,vscode配置环境超详细过程(包括安装vscode和MinGW-W64安装及后续配置使用的详细过程,vscode用户代码片段的使用)[考研专用]-CSDN博客

第二篇:在 VsCode 上编写和调试 C 语言程序_vscode调试c语言-CSDN博客

第三篇,关于路径:浅谈vscode中指代工作区或项目的路径等配置_vscode workspacefolder-CSDN博客

二、新建一个c文件

2.1、安装插件设置成中文

vscode设置中文界面的方法:1、打开vscode,按【ctrl+shift+p】组合键;2、搜索并选择【configure display language】;3、安装中文简体语言,并重启vscode即可

2.2新建c文件

写一个c代码test.c

cpp 复制代码
#include "stdio.h"

int main()
{
    printf("this is a vscode demo!");
    int i;
    printf("Input a number here:");
    scanf("%d", &i);
    printf("We got the %d", i);
    system("pause");
    return 0;
}

根据参考别人的帖子,最后验证下面的几个文件是可行的。

c_cpp_properties.json文件

cpp 复制代码
{
  "configurations": [
    {
      "name": "windows-gcc-x86",
      "includePath": [
        "${workspaceFolder}/**"
      ],
      "compilerPath": "D:/APP/codeBlock/MinGW/bin/gcc.exe",
      "cStandard": "${default}",
      "cppStandard": "${default}",
      "intelliSenseMode": "windows-gcc-x86",
      "compilerArgs": [
        ""
      ]
    }
  ],
  "version": 4
}

launch.json文件

cpp 复制代码
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": true,
      "cwd": "d:/AppData/VsCode/testDemo916",
      "program": "d:/AppData/VsCode/testDemo916/build/Debug/outDebug",
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

settings.json

cpp 复制代码
{
  "C_Cpp_Runner.cCompilerPath": "gcc",
  "C_Cpp_Runner.cppCompilerPath": "g++",
  "C_Cpp_Runner.debuggerPath": "gdb",
  "C_Cpp_Runner.cStandard": "",
  "C_Cpp_Runner.cppStandard": "",
  "C_Cpp_Runner.msvcBatchPath": "",
  "C_Cpp_Runner.useMsvc": false,
  "C_Cpp_Runner.warnings": [
    "-Wall",
    "-Wextra",
    "-Wpedantic",
    "-Wshadow",
    "-Wformat=2",
    "-Wconversion",
    "-Wnull-dereference",
    "-Wsign-conversion"
  ],
  "C_Cpp_Runner.enableWarnings": true,
  "C_Cpp_Runner.warningsAsError": false,
  "C_Cpp_Runner.compilerArgs": [],
  "C_Cpp_Runner.linkerArgs": [],
  "C_Cpp_Runner.includePaths": [],
  "C_Cpp_Runner.includeSearch": [
    "*",
    "**/*"
  ],
  "C_Cpp_Runner.excludeSearch": [
    "**/build",
    "**/build/**",
    "**/.*",
    "**/.*/**",
    "**/.vscode",
    "**/.vscode/**"
  ],
  "C_Cpp_Runner.useAddressSanitizer": false,
  "C_Cpp_Runner.showCompilationTime": false,
  "C_Cpp_Runner.msvcWarnings": [
    "/W4",
    "/permissive-",
    "/w14242",
    "/w14287",
    "/w14296",
    "/w14311",
    "/w14826",
    "/w44062",
    "/w44242",
    "/w14905",
    "/w14906",
    "/w14263",
    "/w44265",
    "/w14928"
  ],
  "C_Cpp_Runner.useUndefinedSanitizer": false,
  "C_Cpp_Runner.useLeakSanitizer": false,
  "C_Cpp_Runner.useLinkTimeOptimization": false,
  "C_Cpp_Runner.msvcSecureNoWarnings": false
}

tasks.json

cpp 复制代码
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: gcc.exe build active file",
			"command": "D:/APP/MinGWposix/mingw64/bin/gcc.exe",
			"args": [
				"-pthread",
				"-fdiagnostics-color=always",
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe",		
				""
			],
			"options": {
				"cwd": "D:/APP/MinGWposix/mingw64/bin"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": "build",
			"detail": "compiler: D:/APP/MinGWposix/mingw64/bin/gcc.exe"
		},
		{
			"type": "cmake",
			"label": "CMake: configure",
			"command": "configure",
			"problemMatcher": [],
			"detail": "CMake template configure task",
			"group": {
				"kind": "build",
				"isDefault": true
			}
		}
	]
}

2.3 说明

1、这个工程还安装了Code runner插件,会在右上角三角形图标下拉菜单下增加一个run code选项。

2、按F5的时候会有一个console窗口,输入字符串后会一闪而过,代码中增加system("pause");可以正常显示代码运行结果。

3、执行"运行C/C++文件"后,代码会在终端显示执行结果。

4、执行"调试C/C++文件"后,代码会进行debug。

5、以上四个文件可以重复使用。

该处使用的url网络请求的数据。


总结

提示:这里对文章进行总结:

例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使d我们快速便捷地处理数据的函数和方法。

相关推荐
csdn_aspnet1 小时前
如何从自定义或本地仓库安装 VsCode 扩展
ide·vscode
患得患失9491 小时前
【前端】【vscode】【.vscode/settings.json】为单个项目配置自动格式化和开发环境
前端·vscode·json
CN-Dust1 小时前
【VSCode】复制到下一行快捷键
ide·vscode·编辑器
FinAnalyzer8 小时前
如何在 InsCodeAI 上搭建并使用 Jupyter Notebook 环境?
ide·python·jupyter
SoveTingღ9 小时前
【开发环境配置】VScode里面配置cmake遇到的问题
c语言·vscode·cmake·嵌入式软件·开发环境配置
vsropy9 小时前
VScode输出中文乱码问题解决
ide·vscode·编辑器
患得患失9499 小时前
【前端】【vueDevTools】使用 vueDevTools 插件并修改默认打开编辑器
前端·编辑器
写点什么啦10 小时前
一键修复ipynb,Jupyter Notebook损坏文件
ide·python·jupyter
DIY全栈开发11 小时前
ESP32S3 Ubuntu vscode如何使用USB-JTAG调试
linux·vscode·ubuntu
Hi_kenyon14 小时前
Vscode的常用快捷键(摆脱鼠标计划)
ide·vscode·计算机外设