Visual studio code debugger error : "Could not find the task 'gcc build active file'

后端 未结 2 1936
礼貌的吻别
礼貌的吻别 2021-01-11 17:47

Im trying to configure a C/C++ workspace in Visual Studio Code using Ubuntu Linux, and I don\'t know how to make the debugger work properly. I copied from the internet a \'t

相关标签:
2条回答
  • 2021-01-11 18:19

    You need to specify path and names of files. Of course debug is only possible if the binary is compiled with g flag (output becomes heavier and less compressed).

    • launch.json would map to binary file

      "program": "${workspaceFolder}/a.out",

    • task.json would relate to how to compile

      "args": [ "-g", "${workspaceFolder}/*.cpp", "-o", "${workspaceFolder}/a.out"

    https://www.youtube.com/watch?v=X2tM21nmzfk&app=desktop

    If you can't make it work through vscode, you may want to use another tool like GDB. GDB also works great in Terminal in Linux/VM and maybe WSL.

    0 讨论(0)
  • 2021-01-11 18:24

    In your task.json file, no task is labeled as 'gcc build active file' which is required as a preLaunchTask in launch.json file.

    So you can either change the label of task or change the content of preLaunchTask to make them match.

    Just change the content of preLaunchTask into "g++ build active file". It will work.

    0 讨论(0)
提交回复
热议问题