dhjdhj
September 12, 2018, 2:11pm
1
Has anyone run into this issue where when I load a project and open a specific H file that was automatically generated (GUI class), the line
#include ""
is inserted just below the //[/Headers]
It’s not in the original header file, so this only occurs when I view the file with Projucer
dhjdhj
February 20, 2019, 3:08pm
2
Really? Nobody else running into this situation?
Yes. I have had this issue as well.
dhjdhj
February 20, 2019, 7:39pm
4
These seems to have been a problem for sometime – I wonder if there’s something in the “producer information section” that can be hacked to fix this. It’s a real PITA
1 Like
This happens because your GUI component has a sub-component of type “Projucer Component” which is not associated with an existing file.
How to reproduce
Let’s consider that we have a GUI Component named Foo
, i.e. we have Foo.cpp
and Foo.h
in our Projucer project
Open Foo.cpp
and navigate to the Subcomponents
tab
Right-click to show the context menu and select “New Projucer Component” to create such a sub-component:
Open Foo.h
to see that it contains:
//[Headers] -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
//[/Headers]
#include ""
How to fix
Solution A - Make the Projucer Component point to an existing Component
Open Foo.cpp
and nagivate to the Subcomponents
tab
Open the file browser by clicking on the ...
button next to Jucer file
Select the .cpp file of another (existing) GUI Component (Bar.cpp
for this example)
See that the Bar
component is added to Foo
:
Open Foo.h
to see that it now contains:
//[Headers] -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
//[/Headers]
#include "Bar.h"
Solution B - Use a Generic Component instead of a Projucer Component
Open Foo.cpp
and navigate to the Code
tab
Scroll to the bottom of the source file to reach the Projucer information section
Edit the XML to convert the Projucer Component into a Generic Component
rename the tag JUCERCOMP
to GENERICCOMPONENT
remove the sourceFile=""
attribute (Projucer might be quicker than you and remove it as soon as you change the tag name)
Open Foo.h
to see that it now contains:
//[Headers] -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
//[/Headers]
2 Likes
dhjdhj
February 24, 2019, 12:44pm
6
Wow…thanks so much for the comprehensive explanation. Will check that asap.
1 Like