This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
undefined reference error/g++-6
- From: sothy shan <sothy dot e98 at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 18 Jul 2017 10:33:43 +0200
- Subject: undefined reference error/g++-6
- Authentication-results: sourceware.org; auth=none
Hi,
I am running g++-6 in UBuntu 16.04. I'm using open-source library to
develop my application.
In the third part library, there is only DTOR and no copy CTOR and
copy assignment.
So I created copy CTOR. The open source library is compiled.
Now I am trying to compile my application. It gives error.
g++-6 test2.cc -lfluid_msg -o test2 -g -fsanitize=address
/tmp/ccEKzcOk.o: In function
`fluid_msg::of10::PacketOut::PacketOut(fluid_msg::of10::PacketOut
const&)':
/usr/local/include/fluid/of10msg.hh:230: undefined reference to
`fluid_msg::PacketOutCommon::PacketOutCommon(fluid_msg::PacketOutCommon
const&)'
collect2: error: ld returned 1 exit status
I dont know why? When compiler creates automatically, it works. It
means when I remove the copy CTOR, compilation goes well.
I wish to know what is problem in linking? may be becasue of
inheritance and copy CTOR.?? PacketOut is inherited from
PacketOutCommon. I declare and defined copy CTOR in PacketOutCommon.
For PacketOut, compiler creates itself.
any help to solve the problem!
Thanks