reference:
在项目文件夹内新建一个.vscode
文件夹,里面新建三个json文件:c_cpp_properties.json
,launch.json
,tasks.json
。
tasks.json
,task是任务的意思,我们的编译和运行就是我们想要vscode执行的任务,为此我们要在tasks.json里写两个task:Build
和 Run
(这里为什么不是 Compile
呢?是因为从源码到可执行的过程中不仅是 编译(Compile) ,还有预编译、链接等过程,用 构建(Build) 来表述更合适)。除了编译和运行,我们还需要进行 调试(Debug) ,这个就不是通过task来实现的了,而是通过 launch.json
文件来实现。
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17763.0",
"compilerPath": "D:\\Users\\16587\\mingw64\\bin\\g++.exe", /*bin目录下的g++.exe,两个反斜杠\\*/
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "${default}"
}
],
"version": 4
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\build\\${fileBasenameNoExtension}.exe", /*收纳exe可执行文件*/
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "D:\\Users\\16587\\mingw64\\bin\\g++.exe", /*bin目录下的gdb.exe,两个反斜杠\\*/
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "task g++"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "D:\\Users\\16587\\mingw64\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\build\\${fileBasenameNoExtension}.exe" // exe改成存在build文件
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
]
}
reference:
由于你的本地 Git 仓库和 GitHub 仓库之间的传输是通过SSH加密的,所以我们需要配置验证信息:
打开git bash
,使用以下命令生成 SSH Key:
$ ssh-keygen -t rsa -C "[email protected]"
后面的 [email protected]
改为你在 Github 上注册的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。
成功的话会在 ~/ 下生成 .ssh
文件夹,进去,打开 id_rsa.pub
,复制里面的 key。回到 github 上,进入 Account => Settings(账户配置)。左边选择 SSH and GPG keys,然后点击 New SSH key 按钮,title 设置标题,可以随便填,粘贴在你电脑上生成的 key。
为了验证是否成功,输入以下命令:
$ ssh -T [email protected]
…\anaconda(Python需要)
…\anaconda\Scripts(conda自带脚本)
…\anaconda\Library\mingw-w64\bin(使用C with python的时D:\Anaconda\Library\bin(jupyter notebook动态库)
使用ipynb文件时,如果要将kernel设置成其他的conda环境,那么在其他的conda的环境中需要安装ipykernel
conda create -n your_env_name python==xx
conda activate your_env_name
pip install ipykernel
reference:https://zhuanlan.zhihu.com/p/166523064
在vscode 拓展应用install
latex workshop
在json文件加入一下代码:
{
"latex-workshop.latex.autoBuild.run": "never",
"latex-workshop.showContextMenu": true,
"latex-workshop.intellisense.package.enabled": true,
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"name": "PDFLaTeX",
"tools": [
"pdflatex"
]
},
{
"name": "BibTeX",
"tools": [
"bibtex"
]
},
{
"name": "LaTeXmk",
"tools": [
"latexmk"
]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
],
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk"
],
"latex-workshop.latex.autoClean.run": "onFailed",
"latex-workshop.latex.recipe.default": "lastUsed",
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click"
}
打开tex文件
–>点击左侧应用选项
–>点击recipe编译(笔者一般用xelatex)
–>若出现√则表示编译成功,出现×则表示编译失败
–>编译成功后删除临时文件