How to avoid Multiple Definitions in C++?
<p>I have a big C++ Project, in which I try to implement a debug function which needs classes from other libraries. Unfortunately these classes share the same name and namespaces with classes called inside the project. I tried to use a static library to avoid multiple definitions, but of course the compiler complains about that issue. So my question: 
It is possible to create that library for the function without that the compiler knows about the called classes inside the function? </p>

<p>I don't know, like a "protected function" or like putting all the code from the libraries inside the function code..</p>

<p><em>Edit: I'm using the g++ compiler.</em></p>

<p><em>Max, I know but so far I see no other way.</em></p>

<p>Schematic, the problem is.</p>

<p>Project:</p>

<pre><code>#include a.h // (old one)
#include a2.h

return a-&gt;something();
return a2-&gt;something(); //debug function
</code></pre>

<p>debug function a2:</p>

<pre><code>#include a.h // (new one!!)

return a-&gt;something(); // (new one!)
</code></pre>

<p>Compiling Process looks so far:</p>

<pre><code>g++ project -la -la2
</code></pre>

<p>That is a very simplified draft. But that's it actually.</p>
