help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to suppress the "multiple definitions of symbol"


From: Maxim Yegorushkin
Subject: Re: How to suppress the "multiple definitions of symbol"
Date: 5 Dec 2006 01:54:19 -0800
User-agent: G2/1.0

csmgroup@gmail.com wrote:

> > No, the lack of inline caused it.
> Hmm, I wanted to say that I found out the error is caused by 'not using
> inline'. I missed that part and it works well for the small code.
>
> The real problem is that even after I  declared the class functions as
> inline, and even after forcing it to alwasy be a inline function, it
> doesn't look like it becomes a inline function under the Mac OS X.
>
> template<class T>
> inline void __attribute__((always_inline))
> SPtr<T>::createInstance(const char  *classID,
>                       IBase       *reserved)
> {
>
> This is an error message.
>
> ld: multiple definitions of symbol
> __ZN8oaCommon4SPtrIN12OpenAccess_46IPcellEE14createInstanceEPKcPNS_5IBaseE
> ../../lib/wafer/mac_osx_32/opt/oaDesignInst.pic.o definition of
> __ZN8oaCommon4SPtrIN12OpenAccess_46IPcellEE14createInstanceEPKcPNS_5IBaseE
> in section (__TEXT,__text)
> ../../lib/wafer/mac_osx_32/opt/oaFrame.pic.o definition of
> __ZN8oaCommon4SPtrIN12OpenAccess_46IPcellEE14createInstanceEPKcPNS_5IBaseE
> in section (__TEXT,__text)
>
> And this is the result for 'nm oaDesignInst.o'. oaDesignInst.o includes
> the SPtr class.
>
>          U oaCommon::oaPlugInMgr::getPlugInMgr()
>          U oaCommon::oaPlugInMgr::createInstance(char const*,
> oaCommon::IBase*, oaCommon::Guid const&, void**)
>          U oaCommon::oaPlugInMgr::getClassFactory(char const*,
> oaCommon::Guid const&, void**)
> 00002128 T oaCommon::SPtr<OpenAccess_4::IPcell>::createInstance(char
> const*, oaCommon::IBase*)
> 00026848 S
> __ZN8oaCommon4SPtrIN12OpenAccess_46IPcellEE14createInstanceEPKcPNS_5IBaseE.eh
>
> Out of the two result, I see that the function is not inlined.

It looks like the object files have not been rebuild after you changed
the function to be inline.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]