Introjucer/Visual Studio 2013 object file clashes


I've got two files (in different directories of course) named State.cpp. When I generate the VS project with the introjucer and try to compile, both of those files clash to the same object file and I get the warning:

Warning    1    warning MSB8027: Two or more files with the name of State.cpp will produce outputs to the same location. This can lead to an incorrect build result.  The files involved are ..\..\..\audio\State.cpp, ..\..\..\sg\State.cpp. 

and then various link errors.

I can correct this easily enough within VS by modifying the Object File Name property on the VS project. However, when I regenerate the project with the Introjucer, that setting gets blown away.

Is there a setting I can use in the Inrojucer's config pages to prevent the clashes? Could the Introjucer generate a project with that property already set to something that doesn't cause clashes?



I'd really recommend just changing the name of one of your files. It's not just VC that will have this problem, most build systems and linkers will choke on it, and you surely don't want to have to hack each of your target platforms in some compiler-specific way just to work around it. Much easier just to give everything different names. (And more informative names than "State" won't do any harm either!)


Xcode has no problem. I used a Scons build system that didn't have this problem. VS can easily be set up to not have this problem (as I metioned above). Makefiles can be set up to avoid this issue. Out of curiosity, is it really that hard to just fix this?

 (And more informative names than "State" won't do any harm either!)

Hey now! The classes in the files are actually called AudioState and SgState, but the prefixes are omitted from the file names for brevity. They accomplish very similar things but in two different subsystems, so having the same name is appropriate.

Anyway, I'll just change the name of my files as you suggest.


is it really that hard to just fix this?

Not hard, but probably not an efficient use of my time! The "correct" fix would be to add code to all the project handler classes in the introjucer to make them check for duplicate names, then add some compiler-specific stuff to rename the relevant obj files. It's not rocket science, but would take hours to research, write and test it, and nobody else has ever asked for it before!


Oh that sounds awful. Are you sure that's the correct fix? On Xcode you don't have to worry. And on Windows it seems all you need to do is to set Output File Name to $(IntDir)/%(RelativeDir)/ (see I don't know about Linux or Android though.


I don't know about Linux or Android though.

Neither do I, which is why these things take a long time! Hope you understand why I can't make this a high priority.


Yeah, I understand. I fixed it for VS 2013:

jucer_ProjectExport_MSVC.h:1232: cl->createNewChildElement ("ObjectFileName")->addTextElement ("$(IntDir)\\\%(RelativeDir)\\");

I was having other name clashes so I decided not to rename files. Maybe you could do a quick test on whether that fix doesn't mess up anything else? I would be satisfied with just having it work for VS, since that's all I'm using.


Actually, that leaves all the intermediates in subdirectories of the .juicer file's directory, so it's not a very good solution, but it works for me. Perhaps someone else can come up with something better.


You know you can actually specify the intermediate folder as a property in the introjucer config?