测试环境deepin和windowslinux
问题的另类描述git
对于新手来讲,处理这类内容(两个json和那一堆参数)真的好难,把个人填坑记录下来,以供后人瞻仰。github
在当前文件是C++的状况下,tasks能够被用来作编译,而launch用来执行编译好的文件shell
建立一个tasks.json文件告诉VS代码如何构建(编译)程序。
翻译:建立一个launch.json文件,以配置VS Code以在按F5调试程序时在WSL上启动GDB 。
我发生这个错误的缘由是由于tasks.json的"label"参数值和launch.json的"preLaunchTask"参数值不一致。json
翻译:解决方法就是 让二者一致。我把他两的值都设为"build c program"windows
> Executing task: gcc -g -o main /home/yjc/Desktop/c/test/main.c < 终端将被任务重用,按任意键关闭。
正常现象测试
参考连接[Linux] Debug launch command shows up in terminal windowspa
大体意思是,正常现象,没有办法隐藏翻译
tasks.json
{ "version": "2.0.0", "tasks": [{ "label": "build c program", "type": "shell", "command": "gcc", "args": [ "-g", "-o", "${fileBasenameNoExtension}", "${file}" ] }] }
launch.json
{ "version": "0.2.0", "configurations": [{ "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "cwd": "${workspaceFolder}", "preLaunchTask": "build c program", }] }
对标准内容作了不少删减,初学用不到怎么多内容
这就很考验人的英语水平了。
官网文档地址Using C++ and WSL in VS Code
WSL是 Windows Subsystem for Linux 的缩写,由于window10中已经能够集成linux,只须要在microsoft store中搜索下载安装便可