title: QtCreator multiple definition build bug
body: <p>this is my .pro file:</p>
  
  <pre><code>QT       += core gui widgets
  
  TARGET = link_mult_def
  
  TEMPLATE = app
  
  SOURCES +=  main.cpp \
              path2/file.cpp \
              path1/file.cpp
  
  HEADERS +=
  </code></pre>
  
  <p>For some reason, QtCreator does not respect the source folder structure when building the .o files from the .cpp files. Both files will be compiled to "shadow_build_directory/file.o". I would expect the build process to create path1 and path2 directories in the shadow build directory and compile "path1/file.cpp" to "shadow_build_directory/path1/file.o" and "path2/file.cpp" to "shadow_build_directory/path2/file.o".</p>
  
  <p>Since the compiled symbols from both sources add up in the file.o it is not such a big problem yet. It becomes a big problem when QtCreator tries to link:</p>
  
  <pre><code>g++ -Wl,-O1 -o link_mult_def main.o file.o file.o -L/usr/lib/x86_64-linux-gnu -lQtCore -lpthread
  </code></pre>
  
  <p>QtCreator links file.o two times which makes the linker fail with mutiple definition error.</p>
  
  <p>How can I make sure that QtCreator compiles to object files that reflect the source directory structure?</p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>path1/file.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  void function1()
  {
      std::cout &lt;&lt; "function1" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>path2/file.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  void function2()
  {
      std::cout &lt;&lt; "function2" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>Build process by QtCreator:</p>
  
  <pre><code>g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../link_mult_def -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I../link_mult_def -I. -o main.o ../link_mult_def/main.cpp
  
  g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../link_mult_def -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I../link_mult_def -I. -o file.o ../link_mult_def/path1/file.cpp
  
  g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../link_mult_def -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I../link_mult_def -I. -o file.o ../link_mult_def/path2/file.cpp
  
  g++ -Wl,-O1 -o link_mult_def main.o file.o file.o    -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtCore -lpthread 
  
  file.o: In function `function2()':
  file.cpp:(.text+0x0): multiple definition of `function2()'
  make: Leaving directory `/home/schmid/code/misc/trash/link_mult_def-build-desktop-Qt_4_8_1_in_PATH__System__Release'
  file.o:file.cpp:(.text+0x0): first defined here
  collect2: error: ld returned 1 exit status
  make: *** [link_mult_def] Error 1
  </code></pre>