i have a largish C++ project, with source-files organised in multiple folders (on the filesystem).
in two of these folders, i have files with the same name.
e.g.
MyProjectfooBlurp.cpp
MyProjectfooFile.cpp
MyProjectarFile.cpp
MyProjectarKnoll.cpp
the project is cross platform, and i use autoconf on linux and OSX, but have to use MSVC on W32 (due to some 3rd party C++ libraries i use on W32 and the C++ binary interface incompatibilities across compilers)
on the MSVC side, the project is organized into multiple "Filters" (those virtual Folders) as well (with names roughly corresponding to the Directories the files live in), so i can distinguish them.
now the problem is, when i build the project, MSVC puts the object files in a single flat diretory, and i end up with:
MyProjectReleaseBlurp.obj
MyProjectReleaseFile.obj
MyProjectReleaseKnoll.obj
as can be seen, there's only one File.obj
, so one binary object is missing.
obviously, the linker complains, since it cannot find classes/functions/... defined in that missing object file.
is there a way to tell MSVC to create object files with a unique name depending on the directories (or filters) those files live in?
i imagine something like:
MyProjectReleasefooBlurp.obj
MyProjectReleasefooFile.obj
MyProjectReleasearFile.obj
MyProjectReleasearKnoll.obj
or
MyProjectReleasefoo-Blurp.obj
...
or whatever.
all other build-systems i know (CMake, autotools) are able to deal with multiple files of the same name.
this question is similar to 3729515, but i'm currently stuck to VS2008.
(the solution suggested there for VS2008 - to set the Object-Directory for each file in question - is something which indeed works theoretically, but which i would like to avoid for practical reasons)
See Question&Answers more detail:
os