I want to include two external libraries that defines functions with the same signature, causing link problems. Is it possible to include these allready compiled libraries in different namespaces, and by that avoiding the name trouble?
@helios:
No I do not have to do that, but I have to link the resulting files into one library, causing linking problem.
@Bazzy:
I think your suggestion will help me creating namespaces I can use in my code for the two libraries. This will be very doable as the public interface to these libraries are very small.
The problem with this solution is that it is not the public interface of these libraries that shares signatures, it is a a quite large "private" interface. These function all call eachothers and I suppose I have to change these signatures too.
In addition I do not think this would help me in the linking stage, as I have to link to both original libraries anyway, exposing the dual signatures.
The "best" solution would probably be to add a namespace declaration in the original library files. The licens is OK, but then I have to keep my own version of the library, which is suboptimal.
Btw, the two libraries are Triangle and Tetgen, two meshgenerating programs.
Hmm... Well this is a very rare problem. Most libraries have a sort of namespace in the identifiers themselves (e.g. FreeImage_*, SDL_*, etc.) so that this kind of thing never happens.
I think just surrounding the definitions with a namespace won't solve anything. If there are duplicate symbols, you'll get duplicate definitions when you link, anyway.
I think the two libraries was developed first and formost as two standalone command prompt applications, with capabilities to be compiled as libraries. The developers then probably did not care too much of attaching any library specific prefix to the names.