LinuxのVisual Studio Codeで、メニューの「デバッグ」のなかにある「デバッグの開始」を選択すると、ターミナルに以下が出力され、正常に実行されません。
ターミナルで以下が出力され、
> Executing task in folder visual_studio_code: /usr/bin/g++-7 -g /home/username/test/main.cpp -o /home/username/test/main < ターミナルはタスクで再利用されます、閉じるには任意のキーを押してください。
上記のターミナルを閉じると、新たにターミナルが現れ、以下が出力されます。
$ env sh /tmp/Microsoft-MIEngine-Cmd-irjoyi0n.mym sort: cannot read: sh: そのようなファイルやディレクトリはありません
対象のコード(C言語)は、hello worldを出力する簡単なものです。
実行ファイルは生成されていて、コンソールから実行すれば、正常にhello worldが出力されます。
tasks.jsonか、launch.jsonを書き換えれば、いいのでしょうか?
tasks.json
{ "tasks": [ { "type": "shell", "label": "g++-7 build active file", "command": "/usr/bin/g++-7", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "options": { "cwd": "/usr/bin" } } ], "version": "2.0.0" }
launch.json
{ // IntelliSense を使用して利用可能な属性を学べます。 // 既存の属性の説明をホバーして表示します。 // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "g++-7 build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "g++-7 build active file", "miDebuggerPath": "/usr/bin/gdb" } ] }
あなたの回答
tips
プレビュー