Ahh the joys of working with VC++. Porting some *nix code across never goes nicely, even when there’s nothing to get cause issues. In porting a spatial augmented reality system we had 2 different Texture.cpp files (one for actual textures, the other for OBJ textures), each in different subfolders, however the VC++ compiler doesn’t overly appreciate this:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of Texture.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are src\geometry\Texture.cpp, src\graphics\Texture.cpp.
The application continues to compile, but you will almost certainly get errors when it includes the wrong file and you go to access a member of the wrong class!
This is a known issue, as the following Microsoft Connect thread shows has been an issue and was meant to be fixed in Visual Studio 2013 Update 1 (I’m using Update 3 and still now fix!):
When VC++ compiles all the files down it puts them all in the one folder and basically just overwrites the first output file with the second. To fix this, you can set it to use the folder name as part of the file output. These instructions were current as of Visual Studio 2013 (Update 3)
- Right click your VC++ project, click “Properties”
- Expand “Configuration Properties”
- Expand “C/C++”
- Select “Output Files”
- Select “Object File Name” and change it from “$(IntDir)” to “$(IntDir)/%(RelativeDir)/”
That way, the folder path is taken into account and not just the file name.
All the best for your coding!