Question: My Qt project have two source files with the same name but in different folder.
The pro file is:

```
SOURCES = A/Test.cpp 
SOURCES += B/Test.cpp

```

It can generate Visual Studio solution file via Qt Visual Studio addon, but it won't work because the generated object file have the same name: Test.obj.
That will cause **LNK2001 unresolved external symbol** because one of Test.obj is overwritten.

How to write proper pro file to deal with that?

Answer: 
### Before Qt 5

You can try adding that line to your .pro file:

```
CONFIG += object_with_source

```

But as the option name implies, the .obj files will not be created in the out-of-source / "shadow build" directory.

### Qt 5 and older

That option has been replaced by [`object_parallel_to_source`](http://code.qt.io/cgit/qt/qtbase.git/commit/?id=47df12225918ba82abe35921af19e547717da58b) in Qt 5, which should work with the shadow building.
I recently came across this issue, too. Splitting the project into subprojects made everything much more complicated, and -at least on my first attempt- flat-out didn't work. Then I tried `CONFIG += object_with_source` and `CONFIG += object_parallel_to_source`, but both did't seem to work with my Qt version.

So this is how I solved it (for Visual Studio 2010; I don't know if works the same with other versions):

If the project were an ordinary Visual Studio project, not one generated by QMake, you could solve it as described here: [Visual Studio 2010 & 2008 can't handle source files with identical names in different folders?](https://stackoverflow.com/questions/3729515/visual-studio-2010-2008-cant-handle-source-files-with-identical-names-in-diff) (changing the output dir of object files to a relative dir by appending `%(RelativeDir)` in the project settings "C/C++" > "Output Files" > "Object File Name").

Obviously, you don't want to do this by hand everytime you create a new Visual Studio project with QMake, so why not automatize it? After all Visual Studio project files are but ordinary XML files. Looking at the diff before and after setting the options reveals it's saved in a single unique tag called `ObjectFileName`.

So I wrote this Python script:

```
import sys

filename = sys.argv[1]
f = open(filename, "r", -1, "utf-8-sig")
lines = f.readlines()
f.close()
f = open(filename, "w", -1, "utf-8-sig")
for line in lines:
    line = line.replace("</ObjectFileName>", "%(RelativeDir)\</ObjectFileName>")
    f.write(line)
f.close()

```

..and use it like this in my bat-file that I always call to create the Visual Studio project:

```
qmake -tp vc myproject.pro
@cd ../scripts
unflatten_vcproj_obj_output.py "../src/myproject.vcxproj"
@pause

```

Not a beautiful solution, but it works.