VS 2003 generating duplicate COMDAT for template instantiation?
Jon Watte <[email protected]> Fri, 11 May 2007 17:47:38 -0700
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to generate a SAS parser/binder using just a little bit of
template programing, and I'm running into the following link error (I'm
using VS 2003). I would like any help I can get in how to work around
this problem. I got it when I was reinterpret_cast-ing from type
Foo::*Bar[N] to Foo::*Bar[], but I worked around that by explicitly
passing in the array size. However, here there are no skanky casts
involved; this should "just work." (And I've tried with and without the
inline Access() function).
Win32DX9Graphics.obj : fatal error LNK1179: invalid or corrupt file:
duplicate COMDAT
'?Access@?$FieldAccessor@USasAmbientLight@impl_DX9@@VFastTriple@pit@@$GA@A@A@@impl_DX9@@QAEABVFastTriple@pit@@ABUSasAmbientLight@2@@Z'
Looking at the templates FieldAccessor, here is the code:
template<typename Container, typename Type, Type Container::*Field>
class FieldAccessor {
public:
typedef Container ContainerType;
typedef Type FieldType;
inline Type const &Access(Container const &c) { return c.*Field; }
};
Here are the two cases where FieldAccessor<> is referenced for the
SasAmbientLight:
// dispatch the child
if (!wcscmp(path, L"color")) {
setter_ = PIT_SYSTEMNEW0("ValueSetter") ValueSetter<
FieldAccessor<SasAmbientLight, pit::FloatTriple,
&SasAmbientLight::color> >
(this, core_->ambientlight_[l]);
return true;
}
return false;
...
// dispatch the child, then return an iterator on that
if (!wcscmp(path, L"color")) {
setter_ = PIT_SYSTEMNEW0("OuterArraySetter") OuterArraySetter<
FieldAccessor<SasAmbientLight, pit::FloatTriple,
&SasAmbientLight::color> >
(this, core_->ambientlight_, &core_->numambientlights_.get());
return true;
}
return false;
pit::FloatTriple is what you'd expect, as is struct SasAmbientLight:
struct SasAmbientLight {
pit::FloatTriple color;
};
Btw: upgrading to 2005 isn't the preferred solution right now.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=555