标签:color vsc 使用 apt The include 替换 from inux
记录一下配置remote-wsl的经历。
主要参考:
1 https://www.bilibili.com/video/av64680234?from=search&seid=9560371442015557844
2 https://blog.csdn.net/SuGeLaInys/article/details/99934184
目的:为了可以在Linux平台上编译代码.
1 假设已经装过了WSL和Mingw64
2 假设已安装Remote-WSL(输入shift+ctrl+x进入extension界面,寻找该扩展)
Win+R,输入cmd
输入wsl 进入wsl界面,输入whereis g++ ;输入whereis gdb
确认二者均在/usr/bin下,如果不是,在wsl下输入sudo apt-get install gdb,sudo apt-get install g++
创建文件夹mkdir test2,cd test2
输入code .进入VsCode界面.
输入shift+ctrl+p,选择 C/C++ edit configuration
需要改动的地方:
1 Compiler Path:/usr/bin/g++
2 IntelliSense mode:default
3 Include Path清空
4 Defines添加_DEBUG;_UNICODE;_UNICODE
输入shift+ctrl+p,选择tasks:configure default build task-----> 使用模板创建task.json文件----->Others
对生成的.json进行替换:
1 { 2 "version": "2.0.0", 3 "windows": { 4 "options": { 5 "shell": { 6 "executable": "bash.exe", 7 "args": [ 8 "-c" 9 ] 10 } 11 } 12 }, 13 "tasks": [ 14 { 15 "label": "g++ build active file", 16 "type": "shell", 17 "command": "/usr/bin/g++", 18 "args": [ 19 "-g", 20 "${file}", 21 "-o", 22 "${fileDirname}/${fileBasenameNoExtension}" 23 ], 24 "group": { 25 "kind": "build", 26 "isDefault": true 27 } 28 } 29 ] 30 }
可进行debug,F5
标签:color vsc 使用 apt The include 替换 from inux
原文地址:https://www.cnblogs.com/Kaifangqu/p/11421763.html