You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Alan Conway <ac...@redhat.com> on 2012/02/20 16:07:14 UTC

C++: Windows EXTERN question

Question: in SequenceNumber.h we have:

class QPID_COMMON_CLASS_EXTERN SequenceNumber : public ...
{
  ...
    int32_t value;

    void decode(Buffer& buffer);
  ...
};

But I'm getting 

76>QueueReplicator.obj : error LNK2019: unresolved external symbol
"public: void __thiscall qpid::framing::SequenceNumber::decode(class
qpid::framing::Buffer
&)" (?decode@SequenceNumber@framing@qpid@@QAEXAAVBuffer@23@@Z)
referenced in function "class qpid::framing::SequenceNumber __cdecl
qpid::ha::`anonymous namespace'::decodeContent<class
qpid::framing::SequenceNumber>(class qpid::broker::Message
&)" (??$decodeContent@VSequenceNumber@framing@qpid@@@?A0x57ef80a8@ha@qpid@@YA?AVSequenceNumber@framing@2@AAVMessage@broker@2@@Z)

Does windows require individual EXTERN declarations on member functions
even if there's a CLASS_EXTERN on the class? Or is there something else
I'm missing?


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


RE: Windows EXTERN question

Posted by Steve Huston <sh...@riverace.com>.
Hi Alan,

> Question: in SequenceNumber.h we have:
>
> class QPID_COMMON_CLASS_EXTERN SequenceNumber : public ...
> {
>   ...
>     int32_t value;
>
>     void decode(Buffer& buffer);
>   ...
> };
>
> But I'm getting
>
> 76>QueueReplicator.obj : error LNK2019: unresolved external symbol
> "public: void __thiscall qpid::framing::SequenceNumber::decode(class
> qpid::framing::Buffer
> &)"
> (?decode@SequenceNumber@framing@qpid@@QAEXAAVBuffer@23@@Z
> )
> referenced in function "class qpid::framing::SequenceNumber __cdecl
> qpid::ha::`anonymous namespace'::decodeContent<class
> qpid::framing::SequenceNumber>(class qpid::broker::Message &)"
> (??$decodeContent@VSequenceNumber@framing@qpid@@@?A0x57ef80
> a8@ha@qpid@@YA?AVSequenceNumber@framing@2@AAVMessage@bro
> ker@2@@Z)
>
> Does windows require individual EXTERN declarations on member functions
> even if there's a CLASS_EXTERN on the class? Or is there something else 
> I'm
> missing?

No, there's no need for member function EXTERNs if the CLASS_EXTERN is there 
and the right macros are set to turn the CLASS_EXTERN on. From the error, 
I'm guessing that either QPID_COMMON_CLASS_EXTERN is not defined correctly, 
or the macro to turn it on is not set up correctly.

-Steve


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


RE: C++: Windows EXTERN question

Posted by Steve Huston <sh...@riverace.com>.
You should not have to do this. Something is wrong with the CLASS version of 
the macro. Let me know if you get stuck.
-Steve

> -----Original Message-----
> From: Alan Conway [mailto:aconway@redhat.com]
> Sent: Monday, February 20, 2012 10:25 AM
> To: dev@qpid.apache.org
> Cc: Steve Huston
> Subject: Re: C++: Windows EXTERN question
>
> On Mon, 2012-02-20 at 10:07 -0500, Alan Conway wrote:
> > Question: in SequenceNumber.h we have:
> >
> > class QPID_COMMON_CLASS_EXTERN SequenceNumber : public ...
> > {
> >   ...
> >     int32_t value;
> >
> >     void decode(Buffer& buffer);
> >   ...
> > };
> >
> > But I'm getting
> >
> > 76>QueueReplicator.obj : error LNK2019: unresolved external symbol
> > "public: void __thiscall qpid::framing::SequenceNumber::decode(class
> > qpid::framing::Buffer
> > &)"
> (?decode@SequenceNumber@framing@qpid@@QAEXAAVBuffer@23@@Z
> )
> > referenced in function "class qpid::framing::SequenceNumber __cdecl
> > qpid::ha::`anonymous namespace'::decodeContent<class
> > qpid::framing::SequenceNumber>(class qpid::broker::Message &)"
> >
> (??$decodeContent@VSequenceNumber@framing@qpid@@@?A0x57ef80
> a8@ha@qpid@
> > @YA?AVSequenceNumber@framing@2@AAVMessage@broker@2@@Z)
> >
> > Does windows require individual EXTERN declarations on member
> > functions even if there's a CLASS_EXTERN on the class? Or is there
> > something else I'm missing?
> >
>
> I noticed that SequenceSet.h has both class and method EXTERNs so I
> followed that example in SequenceNumber.h
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: C++: Windows EXTERN question

Posted by Alan Conway <ac...@redhat.com>.
On Mon, 2012-02-20 at 10:07 -0500, Alan Conway wrote:
> Question: in SequenceNumber.h we have:
> 
> class QPID_COMMON_CLASS_EXTERN SequenceNumber : public ...
> {
>   ...
>     int32_t value;
> 
>     void decode(Buffer& buffer);
>   ...
> };
> 
> But I'm getting 
> 
> 76>QueueReplicator.obj : error LNK2019: unresolved external symbol
> "public: void __thiscall qpid::framing::SequenceNumber::decode(class
> qpid::framing::Buffer
> &)" (?decode@SequenceNumber@framing@qpid@@QAEXAAVBuffer@23@@Z)
> referenced in function "class qpid::framing::SequenceNumber __cdecl
> qpid::ha::`anonymous namespace'::decodeContent<class
> qpid::framing::SequenceNumber>(class qpid::broker::Message
> &)" (??$decodeContent@VSequenceNumber@framing@qpid@@@?A0x57ef80a8@ha@qpid@@YA?AVSequenceNumber@framing@2@AAVMessage@broker@2@@Z)
> 
> Does windows require individual EXTERN declarations on member functions
> even if there's a CLASS_EXTERN on the class? Or is there something else
> I'm missing?
> 

I noticed that SequenceSet.h has both class and method EXTERNs so I
followed that example in SequenceNumber.h


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: C++: Windows EXTERN question

Posted by Chuck Rolke <cr...@redhat.com>.
Try adding QPID_COMMON_EXTERN to the individual functions you want exported:

    QPID_COMMON_EXTERN void decode(Buffer& buffer);

-Chuck

----- Original Message -----
> From: "Alan Conway" <ac...@redhat.com>
> To: "Steve Huston" <sh...@riverace.com>
> Cc: "dev" <de...@qpid.apache.org>
> Sent: Monday, February 20, 2012 10:07:14 AM
> Subject: C++: Windows EXTERN question
> 
> Question: in SequenceNumber.h we have:
> 
> class QPID_COMMON_CLASS_EXTERN SequenceNumber : public ...
> {
>   ...
>     int32_t value;
> 
>     void decode(Buffer& buffer);
>   ...
> };
> 
> But I'm getting
> 
> 76>QueueReplicator.obj : error LNK2019: unresolved external symbol
> "public: void __thiscall qpid::framing::SequenceNumber::decode(class
> qpid::framing::Buffer
> &)" (?decode@SequenceNumber@framing@qpid@@QAEXAAVBuffer@23@@Z)
> referenced in function "class qpid::framing::SequenceNumber __cdecl
> qpid::ha::`anonymous namespace'::decodeContent<class
> qpid::framing::SequenceNumber>(class qpid::broker::Message
> &)"
> (??$decodeContent@VSequenceNumber@framing@qpid@@@?A0x57ef80a8@ha@qpid@@YA?AVSequenceNumber@framing@2@AAVMessage@broker@2@@Z)
> 
> Does windows require individual EXTERN declarations on member
> functions
> even if there's a CLASS_EXTERN on the class? Or is there something
> else
> I'm missing?
> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
> 
> 

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org