目录
7.3 sudo ldconfig 报错/sbin/ldconfig.real: /usr/local/cuda/lib64/libcudnn.so.7 is not a symbolic link
先说下 win上我没配置成功。只配置成功linux了。
一、安装vscode
我使用anaconda安装的,可以参考vscode的主页,有安装方式。
二、安装C/C++插件
按Ctrl + shift + X,搜索C/C++并安装。安装它就行。
三、配置调试和编译文件
3.1 tasks.json文件----生成out文件
为了方便在VScode里编译C++代码,我们可以将类似g++ -g main.cpp等g++命令写入VScode的任务系统。
按ctrl+shift+p打开命令行,输入Tasks: Run task,回车!!!,会出现如下提示:
No task to run found. configure tasks...
再回车,
Create tasks.json file from template
然后选择:
Others Example to run an arbitrary external command.
生成默认的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}", "-o", "${fileBasenameNoExtension}.out"]
}
]
}
这里的label为任务名,我们将”label"= "echo"改为”label"= "build"。
由于我们的指令是g++,这里将”command“=”echo Hello“改为”command“=”g++“。
然后添加g++的参数args。如果我们的g++指令为:g++ -g main.cpp,这里可以把参数设置为如下:
3.2 launch.json文件----执行out文件
选中文件夹/cpp文件,按Ctrl+shift+D,点击左侧的Debug按钮,选择添加配置(Add configuration),然后选择C++(GDB/LLDB)回车!!将自动生成launch.json文件,修改内容如下:
"program": "enter program name, for example ${workspaceFolder}/a.out",
改为
"program": "${workspaceFolder}/${fileBasenameNoExtension}.out",
{
// 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