Hello everybody:
I hope you are all in good health.
I am quite a beginner with JUCE and not so much with C++. That being said, I bring this setup I wrote for people who are trying to use VS Codium on GNU+Linux (in my case, Debian) and want to build projects using the makefile written by Projucer. I hope this post is not found redundant. It is not, as far as I could search.
First of all, we use the Projucer to generate the corresponding auxiliary folders and files inside the project folder. The folders structure should be something like this:
(parent folder)/ProjectName/Builds/LinuxMakefile
(parent folder)/ProjectName/Builds/MacOSX
(parent folder)/ProjectName/Builds/VisualStudio2019
Inside the first folder we should find the makefile. Normally we would issue the āmakeā command from console from this folder and then a new ābuildā subfolder is created, inside of which the executable file will be placed.
We should create a hidden folder at the same level as āBuildsā folder, such as:
(parent folder)/ProjectName/.vscode
This folder should contain four json files (c_cpp_properties.json, launch.json, settings.json and tasks.json) with the following contents:
c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/Source",
"${workspaceFolder}/JuceLibraryCode/**",
// Edit the path to your JUCE modules and user modules here.
// I added them just in case one wants to include other headers than those initially selected with Projucer
"/home/<user>/<path to>/JUCE/modules/**",
"/home/<user>/<path to>/JUCE/userModules/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Compile with make and launch JUCE project.",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/Builds/LinuxMakefile/build/${workspaceFolderBasename}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "build",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
Settings.json: (this is really optional, it helps to point out errors)
{
"C_Cpp.errorSquiggles": "enabled"
}
Tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceFolder}/Builds/LinuxMakefile/"
}
}
]
}
To debug, just select Main.cpp as active file and press āStart debuggingā or āRun build taskā and it should work.
Thank you all for all the knowledge you share in this forum. Happy coding!
Gus Carr