[SOLVED] CMake, VSCode and debugging?

I like using VSCode to do my coding as it feels less overwhelming than with IDEs like Visual Studio or XCode. As a beginner, perhaps I shouldn’t, but still… Either way, I’ve set up my launch.json and tasks.json as follows:

launch.json:

  "version": "0.2.0",
  "configurations": [
    {
      "name": "(lldb) Launch",
      "type": "cppdbg",
      "request": "launch",
      // "program": "/Applications/AudioPluginHost.app",
      "program": "${workspaceFolder}/build/SimpleEQ_artefacts/Standalone/SimpleEQ.app",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "lldb",
      "preLaunchTask": "build"
    }
  ]

and tasks.json

  "version": "2.0.0",
  "tasks": [
    {
      "label": "build",
      "type": "shell",
      "command": "make",
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "options": {
        "cwd": "${workspaceFolder}/build/"
      }
      
    }
  ]

I can’t seem however to be able to print stuff to console, either with std::cout or using the DBG macro. As for the CMakeLists.txt file, I’m simply using a slightly modified version of the AudioPlugin example at github.
I know I have to be missing something, but I’m not sure where to start looking, any help will be appreciated!

Have you installed the C/C++ Extension Pack? I’ve found that after installing that pack, with the CMake extension I can easily debug a JUCE project using a launch.json file similar to the one provided here: Target Debugging and Launching — CMake Tools 1.4.0 documentation

That being said, I haven’t used vscode to debug a plugin so there may a missing step to get that working as expected… what host are you using?

I do have the C/C++ Extension Pack installed. I had the CMake Tools extension disabled though, I remember finding it rather cumbersome for reasons I no longer remember, but I should probably give that a try again, thanks for the link!

I struggled to get it to play nicely to start with too, but starting from scratch and following the various guides online I managed to get it working fairly well.

I realized I originally copy-pasted the tasks.json file twice, I’ve edited to show the launch.json file now too. Also answering your question, I’m using the standalone version and JUCE’s AudioPluginHost.

My launch.json looks like this FWIW… I don’t have a tasks.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${command:cmake.launchTargetPath}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [
                {
                    "name": "PATH",
                    "value": "$PATH:${command:cmake.launchTargetDirectory}"
                }
            ],
            "MIMode": "lldb",
            "logging": {
                "moduleLoad": false
            }
        }
    ]
}

I fixed it! All I had to do was add set(CMAKE_BUILD_TYPE Debug) in CMakeLists.txt (which of course would need to be set to Release when the time came), and then adjust the path in launch.json to

"program": "${workspaceFolder}/build/SimpleEQ_artefacts/Debug/Standalone/SimpleEQ.app"