Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 如何使用WSL以正确的路径运行我的代码?我已经有edit settings.json了_Visual Studio Code_Windows Subsystem For Linux - Fatal编程技术网

Visual studio code 如何使用WSL以正确的路径运行我的代码?我已经有edit settings.json了

Visual studio code 如何使用WSL以正确的路径运行我的代码?我已经有edit settings.json了,visual-studio-code,windows-subsystem-for-linux,Visual Studio Code,Windows Subsystem For Linux,我安装了WSL Ubuntu,但是我不能用WSL在正确的路径上运行我的代码。 如何使用WSL以正确的路径运行我的代码 这是我的settings.json "code-runner.runInTerminal": true "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\wsl.exe" "code-runner.executorMap": { "c": "cd $(wslpath $dir) & gcc $fil

我安装了WSL Ubuntu,但是我不能用WSL在正确的路径上运行我的代码。 如何使用WSL以正确的路径运行我的代码

这是我的settings.json

"code-runner.runInTerminal": true
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\wsl.exe"
"code-runner.executorMap":
{ 
"c": "cd $(wslpath $dir) & gcc $fileName -o $fileNameWithoutExt & ./$fileNameWithoutExt"
"cpp": "g++ $fileName -o $fileNameWithoutExt -std=c++11 & ./$fileNameWithoutExt"}\
"python": "python3 -u ./$fileName"
}
当我使用“ctrl+alt+N”运行代码时 结果是:

jamesqian@J:/mnt/c/Users/Jamesqian/Desktop/tmp$ cd $(wslpath "c:\Users\Jamesqian\Desktop\tmp\") & gcc test.c -o test & ./test
wslpath是