I have a large project with my source code organized in folders. I added the source files to the projucer project (in version 5.0.0 and 5.0.1) from those folder locations, and everything was fine. Now when I add a new file and save the Projucer project, the compiler can no longer find any file that isn’t in the /Source/ directory.
The Projucer can find the files just fine, it’s the compiler that isn’t being told where to look.
Edit: I can reproduce this error easily.
Create a command line project. In the /Source/ directory, create a new folder. Place any header in that folder.
In the projucer, add the header inside the folder to the project.
Save and open in Xcode.
#include the header in main.cpp. Xcode sees the header added in the projucer in the project navigator.
Try and compile, it will fail saying “header.h cannot be found.”
My project has ~90 source files in a variety of directories, so this is a pretty annoying problem when my code compiled fine before updating to 5.0.2 and having the Xcode project overwritten.
looks like the “Use Header Maps” Xcode setting changed from Yes -> No around 5.0.2. Switching it back to “Yes” makes it build for me.
That would be the issue, thanks! I didn’t know that option existed.
I’m having this issue on projects that also compiled before the update, but “Use Header Maps” was already set to Yes. Is anybody experiencing this for other reasons, or are there any other ideas for how to fix this?
My early workaround was to manually add the folder pathways to the header search paths in the exporter settings, which then has to be copy-pasted for both release/debug settings.
Tried that… all my source files are contained within in the Source folder that Projucer creates, and I added that folder to the header search paths. Still no compilation. :\
Did you try …/…/Source? Although it’s pretty awful that files contained in the Source folder aren’t found by the compiler…
I was able to resolve the issue for my source files by adding all folder paths to the header search paths. So I’ve got /…/…/Source, /…/…/Source/GUI/TimbreDeveloper, /…/…/Source/Modeling/SMS, etc. So it’s not recursively searching through subfolders. Maybe it shouldn’t do that, but I thought it should for some reason. Either way, this isn’t an acceptable solution, IMO.
However, I’m now experiencing linker errors with external libraries. These are libraries that I’m including via angle brackets rather than quotes (GSL, FFTW3, etc.), but their file paths had already been added to the header search paths and they were linking/compiling just fine before the update. I’m getting an “Undefined symbols for architecture x86_64” error for function calls referencing those libraries. The Issue Navigator lists the errors as “Apple Mach-O Linker (Id) Error”.
Did you try putting the library paths in “extra library search paths” instead of “header search paths?”
Also I wound up reorganizing my project and now I’m getting dozens of “missing file” warnings, looks like the Xcode project is still looking for files I moved/deleted. Not sure what that’s about.
I’ve already had library paths in “extra library search paths” as well as header paths in “header search paths”. Both are required to include the dependencies that are installed to /usr/local rather than the source directory (GSL, FFTW, etc.). Still haven’t figured out what’s going on.
Are you positive the Use Header Maps is Yes for all the targets?
It is set to yes for all targets in xcode, and I also selected the “USE_HEADERMAP” option in projucer.
You realise those shouldn’t have a slash at the beginning, right?