我无法在Windows 7中使用omnet ++运行我的模拟程序

时间:2017-09-07 01:20:16

标签: omnet++

我正在学习omnet ++来模拟网络。 packeage.ned中的代码如下所示:

    package helloworld.simulations;

    import inet.networklayer.configurator.ipv4.FlatNetworkConfigurator;
    import inet.node.inet.Router;
    import inet.node.inet.StandardHost;

    @license(LGPL);
    network Network
    {
        @display("bgb=519,314");
        submodules:
            Client: StandardHost {
                @display("p=82,217");
            }
            router: Router {
                @display("p=218,117");
            }
            Server: StandardHost {
                @display("p=361,198");
            }
            flatNetworkConfigurator: FlatNetworkConfigurator {
                @display("p=296,46;b=45,44");
            }
        connections:
            Client.ethg++ <--> router.ethg++;
            router.ethg++ <--> Server.ethg++;
    }

omnetpp.ini中的代码如下所示:

    [General]
    network = helloworld.simulations.Network

    **.Client.numTcpApps = 1
    **.Client.tcpApp[0].typename = "TCPBasicClientApp"
    **.Client.tcpApp[0].connectAddress = "Server"
    **.Client.tcpApp[0].connectPort = 80
    **.Client.tcpApp[0].thinkTime = 0s
    **.Client.tcpApp[0].idleInterval = 0s

    **.Server.numTcpApps = 1
    **.Server.tcpApp[0].typename = "TCPEchoApp"
    **.Server.tcpApp[0].localPort = 80

    **.ppp[*].queueType = "DropTailQueue"
    **.ppp[*].queue.frameCapacity = 10

但是,当我运行此程序时,遇到以下问题:enter image description here

现在,我不知道如何解决这个问题。谢谢你的帮助!

1 个答案:

答案 0 :(得分:0)

您是否构建了INET?如果是,请转到mingw控制台并键入:

opp_run -h nedfunctions -l /d/omnetpp-5.1.1/Projects/inet/src/inet | grep firstAvailableOrEmpty

在-l之后有一条通往libINET.dll file的路径。你应该看到类似的东西:

  

firstAvailableOrEmpty:string firstAvailableOrEmpty(...)
      接受任意数量的字符串,将它们解释为NED类型名称(限定或不合格),并返回存在的第一个字符串和   它的C ++实现类也可用。返回空字符串   如果没有这些类型可用。

此外,FlatNetworkConfigurator 的实例必须称为configurator,而不是flatNetworkConfigurator

修改
转到INET媒体资源,然后选择OMNeT++ | Makemake |选择src | Options... | Compile标签| More >>并确保您已设置Export include path for other projectsForce compiling object files for use in DLLs。并在Target标签集Export this shared/static library for other projects中。然后重建INET

然后在你的项目中:

  1. Properties |中Project References确保选中inet
  2. Properties |中OMNeT++ | Makemake |选择包含源文件的目录Options... | Compile并确保选中以下选项:
    • Add include paths exported from referenced projects
    • Add include dir and other compile options from enabled project features
  3. Properties |中OMNeT++ | Makemake |选择包含源文件的目录Options... | Link并确保选中以下选项:

    • Link with libraries exported from referenced projects
    • Add libraries and other linker options from enabled project features
  4. 重建您的项目。