2017-09-07 83 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

相關問題