This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: undefined reference error/g++-6
On Tue, Jul 18, 2017 at 3:52 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 18 July 2017 at 14:07, sothy shan <sothy.e98@gmail.com> wrote:
>> On Tue, Jul 18, 2017 at 3:03 PM, Jonathan Wakely <jwakely.gcc@gmail.com> 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?
>
> Where are these definitions? Did you compile them? If they're supposed
> to be in libfluid_msg did you recreate libfluid_msg to include them?
>
> You're still not providing enough information to help you. You claim
> to have done things correctly, but if you did that you wouldn't have
> an error. So you're doing something wrong, but you're not telling us
> what you've done.
>
> Do you see the problem? You're asking us to debug your code, without
> showing us anything. We can't do that.
when I remove manually libraries and recreated libfluid. It works.
Thanks anyhow your concern.