Xcode does not see header file created by Projuicer

Hi, I am trying to do something really simple: add a new directory Component and in it a header file HorizontalMeter.h. But when I include HorizontalMeter.h in PluginEditor.h at the top level, the compiler does not seem able to find Component/HorizontalMeter.h.

I think this screenshot pretty much sums it up:

I created this directory and file with Projuicer with Add New Group and then Add New Header file, and then waited for Xcode to reflect the new directory and file in the file explorer. By the way, I tried cleaning and rebuilding everything, but the build gets stuck at this same file not found error.

It seems to me like I’m trying to do something really basic: add a new directory and file in Projuicer, then reference the new header file in an existing header file at the top level, so I’m surprised it’s not working. Is there a step I’m missing here?

To get around the issue, I add the new header file HorizontalMeter.h at the same level as PluginEditor.h and include it like:

#include "HorizontalMeter.h"

This way, the project can compile. So I’m not blocked on this issue, but it would still be nice to know how to add files in new directories under Source and have them compile.

In Projucer, you coud add Source/Component to the Header Search Paths option in the Exporters section.

1 Like

Hi @mariuso. If you add new groups and create files within those groups using the Projucer, then when you #include those files, you do not need to specify the group, since the Projucer puts all the files in one directory. So the situation shown in your screenshot would already have worked with:

#include "HorizontalMeter.h"

Normally it’s not necessary to add every group you create to the Header Search Paths.

1 Like

Just tried creating the file again under Component at keeping the same include line (without Component/) and it worked. Thanks for the explanation!

1 Like