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我们快速便捷地处理数据的函数和方法。

相关推荐
MeowKnight95840 分钟前
vscode安装、部署和小技巧 记录
ide·vscode·编辑器
ZeroMxy1 小时前
VSCode 修改默认主题
ide·vscode·编辑器
生莫甲鲁浪戴3 小时前
Android Studio新手开发第二十八天
android·ide·android studio
lanhuazui1020 小时前
【Vscode】显示多个文件 & 打开多个文件时实现标签栏多行显示
vscode·编辑器
八月正好an1 天前
visual studio安装本地帮助手册
ide·visual studio
张较瘦_1 天前
环境搭建 | [入门级]VSCode(Cursor|Trae|Qoder)搭建Java(Springboot3)企业开发环境全流程
java·ide·vscode
生莫甲鲁浪戴1 天前
Android Studio新手开发第二十一天
android·ide·android studio
生莫甲鲁浪戴1 天前
Android Studio新手开发第二十二天
android·ide·android studio
天赐细莲1 天前
(Linux) WSL 通过 VSCode 连接不执行 profile 问题(登录Shell问题)
linux·运维·vscode
暮色驶过苍茫1 天前
VSCode 配置 SSH 远程连接
ide·vscode·ssh