Re: undefined reference error/g++-6

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

 



On Tue, Jul 18, 2017 at 3:03 PM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
> On 18 July 2017 at 13:56, sothy shan wrote:
>> Yes. I already included definition into the  libfluid_msg and compiled
>> as seen below.
>> /////
>> PacketOutCommon(const PacketOutCommon &other);
>
> That's not a definition, that's a declaration.
>
> Where did you define it?
>
> If you only wrote this declaration then the error is completely
> expected. You told the compiler you were defining a copy constructor,
> but then you failed to do it. That means you lied to the compiler.
declared and defined well. Both are msg.hh and msg.cc, respectively.
My definintion are here:

PacketOutCommon::PacketOutCommon(const PacketOutCommon& other) : OFMsg(other)
{



     this->buffer_id_= other.buffer_id_;
     this->actions_len_ =other.actions_len_;
     this->actions_ = other.actions_;

     /

     if (other.data_) {
        this->data_ = ::operator new(other.data_len_);
        memcpy(this->data_, other.data_, other.data_len_);


     }
     else
        this->data_ = nullptr;




     this->data_len_=other.data_len_;



}

PacketOutCommon& PacketOutCommon::operator=( const PacketOutCommon& other)
{




     this->buffer_id_= other.buffer_id_;
     this->actions_len_ =other.actions_len_;
     this->actions_ = other.actions_;


     if (other.data_) {
        this->data_ = ::operator new(other.data_len_);
        memcpy(this->data_, other.data_,other.data_len_);
     }
     else
        this->data_ = nullptr;


     /

     this->data_len_=other.data_len_;
     return *this;
}

OK?



                                            324,0-1       64%



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux