I'm using C++-Builder of RAD 10.2 using the old classic Borland-compiler currently and am using same named source files in some projects. While the file names are identical, the contained classes are placed in different namespaces and those are used as subfolders as well, so the relative path within the project is unique always. Consider the following classes and the dirs they are stored in as example:
view::files_chooser::chosen_files::Dnd
view/files_chooser/chosen_files/Dnd.cpp
view::send_details::recipients::Dnd
view/send_details/recipients/Dnd.cpp
During compilation of the whole project, the following two object files are created:
Win32\Debug\tmp\Dnd.obj
Win32\Debug\tmp\Dnd_0.obj
There's no way to know which object file belongs to which class and in theory it's not a problem if each of them gets compiled always. But if not, it's important to know which object file to replace and the current behaviour is that always the file without index is replaced. Depending on former builds, that might work, if "Dnd_0.obj" contains the other class, but if not, the object file or the other class is missing now and linking fails.
[ilink32 Error] Error: Unresolved external 'view::send_details::recipients::Dnd::~Dnd()' referenced from C:\USERS\[...]\WIN32\DEBUG\TMP\FMSENDDETAILS.OBJ
[ilink32 Error] Error: Unresolved external 'view::send_details::recipients::Dnd::Dnd(view::send_details::recipients::All&, view::send_details::recipients::Events&)' referenced from C:\USERS\[...]\WIN32\DEBUG\TMP\FMSENDDETAILS.OBJ
[ilink32 Error] Error: Unresolved external 'view::send_details::recipients::Dnd::updateDragDetailsSrc(System::TObject *, unsigned int)' referenced from C:\USERS\[...]\WIN32\DEBUG\TMP\FMSENDDETAILS.OBJ
[ilink32 Error] Error: Unresolved external 'view::send_details::recipients::Dnd::disallowRowOn(System::TObject *, unsigned int, bool&) const' referenced from C:\USERS\[...]\WIN32\DEBUG\TMP\FMSENDDETAILS.OBJ
[ilink32 Error] Error: Unresolved external 'view::send_details::recipients::Dnd::onOleDragStop(System::TObject *, int)' referenced from C:\USERS\[...]\WIN32\DEBUG\TMP\FMSENDDETAILS.OBJ
[ilink32 Error] Error: Unresolved external 'view::send_details::recipients::Dnd::updateDragDetailsDest(System::TObject *, unsigned int)' referenced from C:\USERS\[...]\WIN32\DEBUG\TMP\FMSENDDETAILS.OBJ
[ilink32 Error] Error: Unable to perform link
This can easily be reproduced by not compiling the whole project, but only the two individual classes. RAD doesn't seem to use a stable mapping of class file names to object file names, which could easily fix this problem. Some have reported similar problems in Visual Studio, but that seems to provide a way to manually define the resulting file name of the object file. Something which I couldn't find in RAD.
How does Clang handle such cases? Does it store object files within one and the same dir always as well? Does it use some stable naming scheme or is it able to keep the internal relative dir hierarchy of the project?
Thanks!
As requested, the following is an example command line invocation. As it contains the path of the output file to generate (-o.\Win32\Debug\tmp\Dnd.obj
), I guess switching to Clang itself doesn't change a thing here, as comments already suggested.
bcc32 command line for "..\..\..\..\src\src\view\files_chooser\chosen_files\Dnd.cpp"
c:\program files (x86)\embarcadero\studio\19.0\bin\bcc32.exe -D_DEBUG;Winapi_MsxmlintfHPP;LOG4CXX_STATIC;XERCES_STATIC_LIBRARY -n.\Win32\Debug\tmp
-I[...] -y -Q -k -r- -c -tM -tW -C8
-o.\Win32\Debug\tmp\Dnd.obj -w-par -Od -v -vi- -H=.\Win32\Debug\tmp\raw.pch -H ..\..\..\..\src\src\view\files_chooser\chosen_files\Dnd.cpp
Success
Elapsed time: 00:00:00.4