Using a very basic file layout such as
src\main\cpp\ns1\A.cpp src\main\cpp\ns2\A.cpp src\main\cpp\main.cpp src\main\headers\ns1\A.h src\main\headers\ns2\A.h
where ns1::A and ns2::A have different functionality, such as one having a ‘hello()’ and the other a ‘world()’ and main uses both of them. The link step of the process fails with unresolved symbols.
The underlying problem for this is that Visual Studio flattens the paths during compilation into the object files (by default). This causes the compilation of one of the A.cpp to clobber the result of the other one.
Visual Studio usually works around this in vcproj\vcxproj files by detecting when a filename of the same name as one in another path is added. Upon detection, it changes the object output filename for the 2nd and later instances using the /Fo parameter. In the above scenario this would have an effect such as * ns1::A compiles to A.obj * ns2::A compiles to A2.obj and to achieve this, it calls cl with different /Fo parameter values.
Neither gradle’s compilation chain nor how it creates the visual studio project is correct to handle this in 1.11