Hello everybody.
I am trying to implement a new protocol in the INET (or rather
INETMANET) packet, which is called LTP.
In my workspace I have LTP.h, LTP.cc, LTP.msg and a few other files...
Compiling works fine up to the point where I include the line
Define_Module( LTP );
into LTP:cc, so that I can use it as a simple module in Omnetpp.
In LTP.h I have the lines
class LTP: public cSimpleModule{
[..]
public:
LTP(){}
virtual ~LTP();
}
and define the LTP destructor later on in LTP.cc.
The lines alone work fine, but together with the Define_Module macro I
get the following errors however:
../out/gcc-debug/src/LTP.o: In function `~LTP':
/home/sfisches/programs/omnetpp-4.0rc1/inet_test/LTP/src/LTP.cc:19:
undefined reference to `vtable for LTP'
/home/sfisches/programs/omnetpp-4.0rc1/inet_test/LTP/src/LTP.cc:19:
undefined reference to `vtable for LTP'
/home/sfisches/programs/omnetpp-4.0rc1/inet_test/LTP/src/LTP.cc:19:
undefined reference to `vtable for LTP'
../out/gcc-debug/src/LTP.o: In function `(anonymous
namespace)::__onstartup_func_16()':
/home/sfisches/programs/omnetpp-4.0rc1/inet_test/LTP/src/LTP.cc:16:
undefined reference to `typeinfo for LTP'
../out/gcc-debug/src/LTP.o: In function `LTP':
/home/sfisches/programs/omnetpp-4.0rc1/inet_test/LTP/src/LTP.h:69:
undefined reference to `vtable for LTP'
collect2: ld returned 1 exit status
make: *** [../out/gcc-debug/src/LTP] Error 1
whereas line 16 is the Define_Module( LTP);
line 19 the ~LTP() destructor
line 69 the constructor stub LTP(){} in the LTP header file.
I noted that Luca Fabbrini already posted 16 Jan 2009 with the same
problem on this list
(http://www.omnetpp.org/listarchive/msg11934.php)
Does anybody have a clue what the problem is?
Did I set up my environment wrong?
Did I miss something in the code?
Thanks,
Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkmTqyIACgkQUmw6+gqP64KWZQCgikGaejLb86ypsJ0JdXEcnO5J
m2cAoLmWchFuoMTf5HnM88Zv8dfnVtBp
=ad0E
-----END PGP SIGNATURE-----
_______________________________________________
Omnetpp-l mailing list
Omne...@omnetpp.org
http://lists.omnetpp.org/mailman/listinfo/omnetpp-l
Sorry, Can the destructor be virtual?
--------------------------------------------------
From: "Stefan Fisches" <ste...@fisches.de>
Sent: Thursday, February 12, 2009 5:53 AM
To: <omne...@omnetpp.org>
Subject: [Omnetpp-l] vtable and undefined reference errors after
includingDefine_Module();
But the error 'undefined reference to vtable' or so is generated
because the compiler didn't find a definition for the first virtual
method (that goes in the vtable), I.e. the destructor. Provide it with
one and you'll get rid of it
Regards,
Michele
On Feb 12, 2009, at 3:40 AM, "Alfonso Ariza" <aari...@hotmail.com>
wrote:
Thanks for that gentleman.
I promise to read up more C++ stuff so I don't have to bug you with
that kind of C++ based problems again.
Cheers,
Stefan
http://www.daniweb.com/forums/thread114299.html
--------------------------------------------------
From: "Stefan Fisches" <ste...@fisches.de>
Sent: Thursday, February 12, 2009 5:53 AM
To: <omne...@omnetpp.org>
Subject: [Omnetpp-l] vtable and undefined reference errors after
includingDefine_Module();
> -----BEGIN PGP SIGNED MESSAGE-----