|
Boost Users : |
Subject: Re: [Boost-users] [Exception] Duplicate symbol error when using errinfo_api_function in static library
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2013-10-02 20:21:25
On Wed, Oct 2, 2013 at 3:06 PM, Georg Leidinger <
georg.leidinger_at_[hidden]> wrote:
> Hi Emil,
>
> I was able to figure out some more information about the issue and I could
> isolate it a little bit more. First it doesn't matter if it is a static or
> a shared library. Second it is not directly related to the *
> Boost.Exception* library but to the template class *error_info* which is
> used to create the predefined errinfo_xyz types. It is enough to
> instantiate the *errinfo_api_function* type in both doSomething() methods
> in the both implementation files. I am not so good in templates but I guess
> that the compiler creates the same symbol in both object files (ClassA.o
> and ClassB.o) for the type *errinfo_api_function.* I can see this via nm
> that I have the following line in both object files:
>
> *ClassA.o*
> *0000000000059860 s __ZTIN5boost21errinfo_api_function_E*
> *
> *
> *ClassB.o*
> *0000000000059870 s __ZTIN5boost21errinfo_api_function_E *
>
Instantiating a template in two compilation units should not lead to link
errors. That's why I can't understand why this happens.
-- Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net