如何修复 OMNET++ 中的此错误

问题描述 投票:0回答:1

我写了一个基于OMNET的Time Flood协议的时间同步项目,其中拓扑是一个非常简单的三角形,但是编译时总是显示找不到依赖库INET,我做了很多尝试这样做,却无济于事! OMNET++的版本是6.0.2,INET4.5.2 在此输入图片描述

.ini 文件

network = src.TriangleNetwork

# Simulation settings
**.wlan[*].mac.useAck = true
**.wlan[*].mac.retryLimit = 7
**.wlan[*].radio.transmitter.power = 2mW
**.wlan[*].radio.receiver.sensitivity = -85dBm

# PHY layer settings
**.wlan[*].radio.typename = "Ieee80211Radio"
**.wlan[*].mac.typename = "Ieee80211Mac"
**.wlan[*].mgmt.typename = "Ieee80211MgmtAdhoc"

# Mobility
*.node*.mobility.typename = "StaticMobility"

# Position settings
*.node[0].mobility.initialX = 100m
*.node[0].mobility.initialY = 300m
*.node[1].mobility.initialX = 400m
*.node[1].mobility.initialY = 300m
*.node[2].mobility.initialX = 250m
*.node[2].mobility.initialY = 500m

# Simulation time limit
sim-time-limit = 100s

.ned 文件

package src;
import inet.node.inet.StandardHost;
import inet.physicallayer.wireless.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
import inet.mobility.static.StationaryMobility;

channel Link extends ned.DatarateChannel {
    datarate = 100Mbps;
    delay = 1ms; // Fixed delay
}

network TriangleNetwork {
    parameters:
        int initiator = default(0); // Set the initiator node index
        @display("bgb=500,500");

    submodules:
        radioMedium: Ieee80211ScalarRadioMedium {
            @display("p=250,250");
        }
        node[0]: StandardHost {
            parameters:
                numWlanInterfaces = 1;
                @display("p=100,300;i=device/laptop");
                wlan[0].typename = "Ieee80211Nic";
                mobility.typename = "StaticMobility";
        }
        node[1]: StandardHost {
            parameters:
                numWlanInterfaces = 1;
                @display("p=400,300;i=device/laptop");
                wlan[0].typename = "Ieee80211Nic";
                mobility.typename = "StaticMobility";
        }
        node[2]: StandardHost {
            parameters:
                numWlanInterfaces = 1;
                @display("p=250,500;i=device/laptop");
                wlan[0].typename = "Ieee80211Nic";
                mobility.typename = "StaticMobility";
        }

    connections:
        node[0].wlan[0].radioIn <-- radioMedium.medium;
        node[0].wlan[0].radioOut --> radioMedium.medium;
        node[1].wlan[0].radioIn <-- radioMedium.medium;
        node[1].wlan[0].radioOut --> radioMedium.medium;
        node[2].wlan[0].radioIn <-- radioMedium.medium;
        node[2].wlan[0].radioOut --> radioMedium.medium;

        node[0].wlan[0].mac <--> Link <--> node[1].wlan[0].mac;
        node[1].wlan[0].mac <--> Link <--> node[2].wlan[0].mac;
        node[2].wlan[0].mac <--> Link <--> node[0].wlan[0].mac;
}

这是我的 makefile 文件

#
# OMNeT++/OMNEST Makefile for Syn
#
# This file was generated with the command:
#  opp_makemake -f --deep -KINET_PROJ=../../inet -DINET_IMPORT -I../inet/src -I$$\(INET_PROJ\)/src -I$$\(INET_PROJ\)/src -L$$\(INET_PROJ\)/src -L$$\(INET_PROJ\)/src -linet -lINET$$\(D\) -- ../inet/src
#

# Name of target to be created (-o option)
TARGET_DIR = .
TARGET_NAME = Syn$(D)
TARGET = $(TARGET_NAME)$(EXE_SUFFIX)
TARGET_IMPLIB = $(TARGET_NAME)$(IMPLIB_SUFFIX)
TARGET_IMPDEF = $(TARGET_NAME)$(IMPDEF_SUFFIX)
TARGET_FILES = $(TARGET_DIR)/$(TARGET)

# User interface (uncomment one) (-u option)
USERIF_LIBS = $(ALL_ENV_LIBS) # that is, $(QTENV_LIBS) $(CMDENV_LIBS)
#USERIF_LIBS = $(CMDENV_LIBS)
#USERIF_LIBS = $(QTENV_LIBS)

# C++ include paths (with -I)
INCLUDE_PATH = -I../inet/src -I$(INET_PROJ)/src -I$(INET_PROJ)/src

# Additional object and library files to link with
EXTRA_OBJS = ../inet/src

# Additional libraries (-L, -l options)
LIBS = $(LDFLAG_LIBPATH)$(INET_PROJ)/src $(LDFLAG_LIBPATH)$(INET_PROJ)/src  -linet -lINET$(D)

# Output directory
PROJECT_OUTPUT_DIR = ../out
PROJECTRELATIVE_PATH = src
O = $(PROJECT_OUTPUT_DIR)/$(CONFIGNAME)/$(PROJECTRELATIVE_PATH)

# Object files for local .cc, .msg and .sm files
OBJS = $O/Adjust/ClockSyncApp.o $O/FTSP/FtspModule.o

# Message files
MSGFILES =

# SM files
SMFILES =

# Other makefile variables (-K)
INET_PROJ=../../inet

#------------------------------------------------------------------------------

# Pull in OMNeT++ configuration (Makefile.inc)

ifneq ("$(OMNETPP_CONFIGFILE)","")
CONFIGFILE = $(OMNETPP_CONFIGFILE)
else
CONFIGFILE = $(shell opp_configfilepath)
endif

ifeq ("$(wildcard $(CONFIGFILE))","")
$(error Config file '$(CONFIGFILE)' does not exist -- add the OMNeT++ bin directory to the path so that opp_configfilepath can be found, or set the OMNETPP_CONFIGFILE variable to point to Makefile.inc)
endif

include $(CONFIGFILE)

# Simulation kernel and user interface libraries
OMNETPP_LIBS = $(OPPMAIN_LIB) $(USERIF_LIBS) $(KERNEL_LIBS) $(SYS_LIBS)
ifneq ($(PLATFORM),win32)
LIBS += -Wl,-rpath,$(abspath $(INET_PROJ)/src) -Wl,-rpath,$(abspath $(INET_PROJ)/src)
endif

COPTS = $(CFLAGS) $(IMPORT_DEFINES) -DINET_IMPORT $(INCLUDE_PATH) -I$(OMNETPP_INCL_DIR)
MSGCOPTS = $(INCLUDE_PATH)
SMCOPTS =

# we want to recompile everything if COPTS changes,
# so we store COPTS into $COPTS_FILE (if COPTS has changed since last build)
# and make the object files depend on it
COPTS_FILE = $O/.last-copts
ifneq ("$(COPTS)","$(shell cat $(COPTS_FILE) 2>/dev/null || echo '')")
  $(shell $(MKPATH) "$O")
  $(file >$(COPTS_FILE),$(COPTS))
endif

#------------------------------------------------------------------------------
# User-supplied makefile fragment(s)
-include makefrag

#------------------------------------------------------------------------------

# Main target
all: $(TARGET_FILES)

$(TARGET_DIR)/% :: $O/%
    @mkdir -p $(TARGET_DIR)
    $(Q)$(LN) $< $@
ifeq ($(TOOLCHAIN_NAME),clang-msabi)
    -$(Q)-$(LN) $(<:%.dll=%.lib) $(@:%.dll=%.lib) 2>/dev/null

$O/$(TARGET_NAME).pdb: $O/$(TARGET)
endif

$O/$(TARGET): $(OBJS)  $(wildcard $(EXTRA_OBJS)) Makefile $(CONFIGFILE)
    @$(MKPATH) $O
    @echo Creating executable: $@
    $(Q)$(CXX) $(LDFLAGS) -o $O/$(TARGET) $(OBJS) $(EXTRA_OBJS) $(AS_NEEDED_OFF) $(WHOLE_ARCHIVE_ON) $(LIBS) $(WHOLE_ARCHIVE_OFF) $(OMNETPP_LIBS)

.PHONY: all clean cleanall depend msgheaders smheaders

# disabling all implicit rules
.SUFFIXES :
.PRECIOUS : %_m.h %_m.cc

$O/%.o: %.cc $(COPTS_FILE) | msgheaders smheaders
    @$(MKPATH) $(dir $@)
    $(qecho) "$<"
    $(Q)$(CXX) -c $(CXXFLAGS) $(COPTS) -o $@ $<

%_m.cc %_m.h: %.msg
    $(qecho) MSGC: $<
    $(Q)$(MSGC) -s _m.cc -MD -MP -MF $O/$(basename $<)_m.h.d $(MSGCOPTS) $?

%_sm.cc %_sm.h: %.sm
    $(qecho) SMC: $<
    $(Q)$(SMC) -c++ -suffix cc $(SMCOPTS) $?

msgheaders: $(MSGFILES:.msg=_m.h)

smheaders: $(SMFILES:.sm=_sm.h)

clean:
    $(qecho) Cleaning $(TARGET)
    $(Q)-rm -rf $O
    $(Q)-rm -f $(TARGET_FILES)
    $(Q)-rm -f $(call opp_rwildcard, . , *_m.cc *_m.h *_sm.cc *_sm.h)

cleanall:
    $(Q)$(CLEANALL_COMMAND)
    $(Q)-rm -rf $(PROJECT_OUTPUT_DIR)

help:
    @echo "$$HELP_SYNOPSYS"
    @echo "$$HELP_TARGETS"
    @echo "$$HELP_VARIABLES"
    @echo "$$HELP_EXAMPLES"

# include all dependencies
-include $(OBJS:%=%.d) $(MSGFILES:%.msg=$O/%_m.h.d)

错误是这样的 我想知道如何修改这个bug,另外,有人可以提供OMNET基于flood协议的时间同步开源项目提供给我学习一下,如果可以我将不胜感激!

omnet++ inet
1个回答
0
投票

您是否选择了 INET 作为您项目的参考项目?如果没有,请在 IDE 中打开您的项目,转到

Project
|
Properties
,然后选择
Project References
并在列表中标记 INET。

© www.soinside.com 2019 - 2024. All rights reserved.