{ "version": "0.2.0", "configurations": [ { "name": "CUDA C++: Launch", "type": "cuda-gdb", "request": "launch", "program": "${fileDirname}/test.err", "debuggerPath": "/usr/local/cuda-12.0/bin/cuda-gdb", "preLaunchTask": "mynvcc", }, { "name": "CUDA C++: Attach", "type": "cuda-gdb", "request": "attach" }, ] }
问题提要:配置launch.json文件的时候,需要生成的program(如上例为test.err)成功生成,但vscode提示test.err no such file or directory的问题
原因:vscode debug时会进入debug下的文件路径,和我们想要的文件路径并不一致。
解决方法:将launch.json文件进行修改即可。
{ "version": "0.2.0", "configurations": [ { "name": "CUDA C++: Launch", "type": "cuda-gdb", "request": "launch", "program": "${fileDirname}/test.err", "debuggerPath": "/usr/local/cuda-12.0/bin/cuda-gdb", "preLaunchTask": "mynvcc", "cwd":"" }, { "name": "CUDA C++: Attach", "type": "cuda-gdb", "request": "attach" }, ] }
附成功debug的几个其他json文件:
tasks.json
{ "version": "2.0.0", "tasks": [ { "label": "mynvcc", "type": "shell", "command": "nvcc", "args": [ "-std=c++17", "-g", "-G", "-lz", "-o", "${fileDirname}/test.err", "main.cu"], } ] }
c_cpp_properties.json
{ "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**" ], "compilerPath": "/usr/local/cuda-12.0/bin/nvcc", "cStandard": "c17", "cppStandard": "gnu++17", "intelliSenseMode": "linux-gcc-x64", "compilerArgs": [ "" ] } ], "version": 4 }
标签:name,err,no,vscode,json,gdb,cuda,ubuntu,debug From: https://www.cnblogs.com/zhimingyiji/p/17416142.html