vscode只是一个可以额外增加很多插件的编辑器!
windows python环境配置:
1.windows得装python,安装时候记得勾选把路径添加到环境变量。这个可以提供vscode调试时候的解释器。
win+r->cmd
>python #有输出内容,证明已经添加到了环境变量
2.vscode会显示“Linter pylint is not installed”, “python Flake8 is not installed”。
因为python解释器会调用这两个代码检测工具先检查代码
也可以手动安装,在powershell里面(ctrl+`):
>& C:/Users/dli/AppData/Local/Programs/Python/Python37/python.exe -m pip install -U flake8 --user
3.在vscode中安装python的插件,使vscode支持python code的编辑。
windows c++环境配置:
1.window得安装mingw, 安装时候Archiecture一项自行判断修改。用于给c++ code提供调试的g++。
2.在vscode中安装c/c++插件,插件也需要配置。
3.c_cpp_properties.json, task.json, launch.json的区别和配置。
参考:https://code.visualstudio.com/docs/cpp/config-mingw
c_cpp_properties.json是插件c/c++的配置文件:
ctrl+shift+p
>c/c++: Edit Configurations…
“intelliSenseMode”: “gcc-x64”
“compilerPath”: “C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe”
task.json是vscode进行编译和运行操作所需要的文件:
ctrl+shift+p
>Tasks: Configure Task->Select a Task Runner
>MSBuild
launch.json是debug时候需要的:
4.ds
配置文件:
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
//"preLaunchTask": "g++.exe build active file"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "g++.exe build active file",
"command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"--std=c++11",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin"
}
}
]
}
一些相关的执行command:
1.可以通过插件:code runner
2.ctrl + ~
3.ds
第二种就相当于在linux下的操作了,自己输入编译命令,g++ …, 如果要调试了就输入gdb…
windows 远程开发环境配置:
1.windows得安装OpenSSH client。
2.在vscode中安装Remote-SSH,这个插件需要配置、
3. 如何断开Remote-SSH: 在file里面有一个断开远程连接的操作,或者在远程连接的情况下,open_file时候,选择
本地文件,我觉得应该也可以
5. ds