How to debug JUCE project using VS Code on Linux?

I have a plugin that runs on Windows, Mac, and now trying to build on Linux, but it has been a long time since I used Linux. I thought I would try AudioPluiginHost before trying my project.

Installed Ubuntu 20.04.5 LTS. Cloned Juce 7.0.2 and followed the instructions for the Linux dependencies - installed. Navigated to the Projucer directory and ran the make file which built Projucer and launched it via the command ./Projucer

In Projucer, opened AudioPluginHost.jucer made sure all of the paths are pointing to the modules and saved which wrote out a new make file(?), built the project and run it by navigating to the build folder and launched via command ./AudioPluginHost

Installed Visual Studio Code, added C++ and added CMake tools, Make file tools, C++ Extension Pack and Cmake twxs. Not sure if there is a conflict with any of these…

In Visual Studio Code, opened folder AudioPluginHost and added the following to the top of CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(GUI_APP_EXAMPLE VERSION 0.0.1)
set(CMAKE_BUILD_TYPE Debug)
add_subdirectory(“/home/mitch/Documents/JUCE” JUCE)

Then in Visual Studio Code, right clicking on the CMakeList.txt and select: “Clean Reconfigure All Projects” which builds juceaide and then right click on CMakeList.txt again and select “Clean Rebuild All Projects” and builds to AudioPluginHost_artefacts/Debug/AudioPluginHost in which I can launch from the command line with ./AudioPluginHost.

Now the question in the title, how do I run and step through the code in Visual Studio Code?

If I click on any of the code in VSC, like MainHostWindow.cpp, it says cannot open source file “juce_core/system/juce_TargetPlatform.h” (dependency of “MainHostWindow.h”)C/C++(1696)

If I look into the c_cpp_properties.json I have the following:

{
“configurations”: [
{
“name”: “Linux”,
“includePath”: [
“${workspaceFolder}/",
"/home/mitch/Documents/JUCE/

],
“defines”: ,
“compilerPath”: “/usr/bin/gcc”,
“cStandard”: “gnu17”,
“cppStandard”: “gnu++14”,
“intelliSenseMode”: “linux-gcc-x64”,
“configurationProvider”: “ms-vscode.makefile-tools”
}
],
“version”: 4
}

So it seems not to be able to find the includes, and assuming there is a way to fix that, how does one run with the debugger?

Any assistance appreciated.

Explained pretty well here:

Incidentally, this is why I copy JUCE modules into my project folder, as submodules - makes navigation a heck of a lot easier, even if it means “git submodule add …”

1 Like

@austrianaudioJV Thankyou!

1 Like