In my Projucer project, I have two files named “filter.cpp” in different directories. The thing is that, as it seems, the object files are put to the same directory inside “Build”, hence the “filter.obj” is seemingly overwritten, and I need symbols from both for it to link properly.
Any workarounds for this situation? I could rename the file which I have control over, of course, but I think there should be a more proper solution.
I’m not aware of a good general solution, so in most cases I’d recommend giving each file in your project a short prefix (4 chars or so) that identifies its owning module. You could also use the name of the author/organisation as a prefix if you can guarantee that all files from that source will be otherwise uniquely-named, e.g. all JUCE module sources have the prefix juce_, which is intended to avoid collisions with user code.
What bothers me, though, is the possibility that at some pointt I use two 3rd party submodules each defining “filter.cpp”. Then I guess this workaround won’t work. How would you approach this?
For now the only workable approach in this (luckily, theoretical) situation appears to manage MSVC Solution manually, without Projucer.
I have built Projucer locally with the change I posted here: FR: Change ObjectFileName in Projucer MSVC Exporter to fix the issue for a monorepo project I’ve been working on that has a bunch of different PluginProcessor and PluginEditor files in different subfolders, would be nice to see a change along these lines pulled into JUCE itself
In general Xcode can handle two files with the same name in separate folders.. Visual Studio doesn’t like it at all - so best to avoid duplicate file names.
Thanks guys. I guess I’ll do the easiest thing and give “my” files a prefix and hope that it gets fixed in Projucer before I get another clash after incorporating another external submodule.