0
votes

I'm using omnet++ 6.0 and INET 4.3 with gcc compiler. I try to make a simple module inheriting an INET class as shown below resulting in duplicate symbol errors while building. I don't know why. Codes are made as simple as possible only to reveal the build error. Is there anything critical missing in the approach?

When Define_Module() is added in the .cc file, the duplicate symbol build error occurs. The part of the build error message is as follows:

../../inet4.3/src/inet/common/packet/tag/SharingRegionTagSet.h:318:55: warning: 'const inet::SharingRegionTagSet::RegionTag<inet::TagBase>& inet::SharingRegionTagSet::getRegionTag(int) const' redeclared without dllimport attribute after being referenced with dll linkage
  318 | inline const SharingRegionTagSet::RegionTag<TagBase>& SharingRegionTagSet::getRegionTag(int index) const
      |                                                       ^~~~~~~~~~~~~~~~~~~
../../inet4.3/src/inet/common/packet/tag/SharingRegionTagSet.h:323:54: warning: 'const inet::SharingRegionTagSet::RegionTag<inet::TagBase> inet::SharingRegionTagSet::getRegionTagForUpdate(int)' redeclared without dllimport attribute after being referenced with dll linkage
  323 | inline const SharingRegionTagSet::RegionTag<TagBase> SharingRegionTagSet::getRegionTagForUpdate(int index)
      |                                                      ^~~~~~~~~~~~~~~~~~~
Creating executable: ../out/gcc-release/src/hdc.exe
lld-link: error: duplicate symbol: virtual thunk to inet::queueing::PacketFilterBase::getConsumer(omnetpp::cGate*)
>>> defined at ../out/gcc-release/src/my8021qTagEpdHeaderChecker.o
>>> defined at libINET.dll

The corresponding ned file "my8021qTagEpdHeaderChecker.ned" is ..

import inet.linklayer.ieee8021q.Ieee8021qTagEpdHeaderChecker;

simple my8021qTagEpdHeaderChecker extends Ieee8021qTagEpdHeaderChecker //like IIeee8021qTagEpdHeaderChecker
{
    parameters:
        
        @class(inet::my8021qTagEpdHeaderChecker);
        @display("i=block/checker");   
    
}

and the header file "my8021qTagEpdHeaderChecker.h" is

#include "inet/linklayer/ieee8021q/Ieee8021qTagEpdHeaderChecker.h"

namespace inet {

class my8021qTagEpdHeaderChecker : public Ieee8021qTagEpdHeaderChecker
{

protected:
 //   virtual void processPacket(Packet *packet) override;
};

} // namespace inet

and the .cc file "my8021qTagEpdHeaderChecker.cc" is made as

#include "my8021qTagEpdHeaderChecker.h"

namespace inet {

Define_Module(my8021qTagEpdHeaderChecker);


}
1

1 Answers

0
votes

This might be an issue with the ordering of the header files in your files or in INET. Try to include the INETDefs.h file as the first include in all of your header files.