2017-09-07 82 views
0

我正在学习omnet ++来模拟网络。在packeage.ned的代码如下所示:我无法在Windows 7中使用omnet ++运行仿真程序

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

现在,我不怎么解决这个问题。感谢您的帮助!

回答

0

你有没有建INET?如果是的话,转到mingw控制台,输入:

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

-l之后有你libINET.dll file的路径。你应该看到:

firstAvailableOrEmpty:字符串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. 重建项目。

+0

谢谢你的帮助。对不起,我是初学者。我仍然有问题。我在mingw控制台中输入了字符串并获得以下结果:firstAvailableOrEmpty:string firstAvailableOrEmpty(...) 那么,下一步该怎么做?再次感谢你! – user3395974

+0

您是如何创建您的示例的 - 作为INET中的新项目或文件夹? –

+0

我将我的例子创建为一个新项目。不是INET内的文件夹。 – user3395974

相关问题