title: Matlab MEX C++ two files with same name in different folders
body: <p>I'm trying to compile some C++ files that have the same name (fileA) but located in different folders (folder1 and folder2), lets say:</p>
  
  <pre><code>folder1/fileA.cpp
  folder1/fileB.cpp
  </code></pre>
  
  <p>and</p>
  
  <pre><code>folder2/fileA.cpp
  folder2/fileC.cpp
  </code></pre>
  
  <p>These files contain different classes.</p>
  
  <p>But <code>mex</code> creates the objects for both folder1/fileA.cpp and folder2/fileA.cpp in the same folder so when it tries to generate the final W32 file some classes are missing.</p>
  
  <p>Is there any way of telling mex to do not "flatten" the folders structure and then not overwriting one fileA.obj with the other fileA.obj?</p>
  
  <hr>
  
  <p>All proposed solutions end up with the same basic idea: <strong>prepare my own compilation process</strong> (i.e. <em>Makefiles</em> or similar). <em>My problem</em> with this solution is that they are not the same for Linux, Windows, 32 or 64 bits,... and are not easy to maintain. That's why I would have preferred to have a solution based on <code>mex</code> but seems that it is something not supported so ...</p>