'How can I get "go to definition" working in a JUCE project?

I'm trying to get "go to definition" working for a JUCE project created with Projucer. I've tried both CLion and Visual Studio Code, but they can't seem to find definitions that live in the JUCE libraries.

I'm on Ubuntu. Is there a blessed path for this? I'm normally a vim user, but I'm willing to try any IDE.



Solution 1:[1]

What I ended up doing was using FRUT to convert my project from a Projucer project to a CMake project. CLion was able to understand the CMake project, and thus, the "go to definition" and autocomplete features started working.

Solution 2:[2]

I've just figured this out!

In VS Code go View and Command Palette and type C/C++: Edit Configurations (UI) which will take to the IntelliSense Configurations page. Under Include path, on a new line, specify the path to JUCE e.g. ~/JUCE/**.

Note: The two stars are needed to tell VS Code to look through subdirectories.

This will create a hidden folder .vscode in your project folder with this configuration.

You will need to repeat these steps for each project you make.

Definitions and code completion should now work.

To compile your code, in your project folder go Builds then LinuxMakefile and in a terminal run the command make. Finally, go to the builds folder and run your project ./exampleProject.

Solution 3:[3]

You need to add the JUCE/modules folder to your search path, not the top-level JUCE/ folder!

If you're using the Projucer, you'll also need to add the JuceLibrarySource/ folder to your search path.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jim
Solution 2 Break
Solution 3 ImJimmi