I’m compiling my existing JUCE Project on Linux and I get a weird compiler error.
The error basically says that juce::TextButton’s methods are defined but juce::Component’s methods are not and thus are not valid nor accessible. How is this possible, when TextButton is inherited from Component? This is especially puzzling as the same piece of code compiles without issues on Mac and Windows platforms. The error says:
class juce::TextButton has no member named setHasFocusOutline
Which refers to this line in the below code:
What I’m basically doing is this:
for (auto& b : recordingRadioButtons)
The class itself defines recordingRadioButtons like this:
std::array<juce::TextButton, 3> recordingRadioButtons;
What could be causing this compilation error?
Are you using the same JUCE version on all platforms? I don’t know when the function in question was introduced, but it might be that you’re using an older JUCE revision on Linux, where setHasFocusOutline() isn’t implemented yet.
I’m using the exact same git branch/version on all platforms.
And to add to the puzzle:
If I create a minimal test which uses that same feature, it compiles in that test.
The only real differences I can think of between my test and the code that doesn’t compile are:
In the minimal test, the code is inside the MainComponent.cpp when it compiles. In the actual software which doesn’t compile, the code is not in the same class/CPP/H file as the MainComponent, but still in side the main JUCE project.
The content of the JuceHeader.h is obviously different. So maybe it’s something that’s happening there? But this is still puzzling as juce::Component is obviously defined as the class that’s calling that TextButton thing is itself derived from juce::Component, so it’s definitely available and should have no problems being defined.
One difference I can see between the test project and the actual application project is this:
The test project defines paths to modules with relative paths “…/…/thisAndThat”.
The actual application I’m trying to compile defines those paths with “Global”.
Both have the “Use Global AppConfig Header” set to “Disabled” in the Projucer configuration.
I created the application’s project with older version of JUCE about two years ago. Then I updated to JUCE 7.0.2 this year’s summer. So maybe the old JUCE did things differently when setting up the initial project and some of that is causing the issues here?
You might check your Global Directories in the Projucer App on your Linux box. It is under the File menu. It may be pointing to an old JUCE directory.
Indeed they were pointing to wrong directories.
I changed them to point to the rightlocations, but I still get the same error.
I updated all three of the paths: “Path to JUCE”, “JUCE Modules” and “User Modules”.
But we’re definitely on the right track: when I deleted the wrong folder after updating the paths, I get immediately some compilation error which tells me that the system can’t find some files. So I must be using two different JUCE folders at the same time or something. I’d better check this more deeply.
Did you regen your ide project files in Projucer? You might also check your include paths for your builds.
Now it seems to work properly. I removed everything I could imagine regarding the other JUCE folder. Then compiled the proper one once again and confirmed that the paths were pointing to the right folders.
Now all I get is a compiler error regarding instrinsic functions which are a different issue altogether. I simply need to figure out which GCC compiler settings and/or intrinsics are available on Linux and adjust things for that.