首页 > 解决方案 > 我还需要做什么才能在 Omnet++ 中运行 lwIP 模拟?

问题描述

我仍在尝试在 Omnet 5.6.1(使用 INET 4.2.5)inet/examples/inet/nclients/omnetpp.ini 上运行以下模拟。当我在“项目功能”窗口中选中没有 TCP (lwIP) 复选框的情况下构建 INET 时,我得到了一个干净的构建。如果我选中复选框,我会收到以下 26 个错误:

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:47:9: error: expected ';' at end of declaration list
  u32_t s_addr;

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:69:7: error: functions that differ only in their return type cannot be overloaded
u32_t inet_addr(const char *cp);

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:69:7: warning: 'inet_addr' redeclared without 'dllimport' attribute: previous 'dllimport' ignored [-Winconsistent-dllimport]
u32_t inet_addr(const char *cp);

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:47:9: error: expected ';' at end of declaration list
  u32_t s_addr;

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:69:7: error: functions that differ only in their return type cannot be overloaded
u32_t inet_addr(const char *cp);

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:69:7: warning: 'inet_addr' redeclared without 'dllimport' attribute: previous 'dllimport' ignored [-Winconsistent-dllimport]
u32_t inet_addr(const char *cp);

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:71:7: error: conflicting types for 'inet_ntoa'
char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:71:7: warning: 'inet_ntoa' redeclared without 'dllimport' attribute: previous 'dllimport' ignored [-Winconsistent-dllimport]
char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:47:9: error: expected ';' at end of declaration list
  u32_t s_addr;

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:71:7: error: conflicting types for 'inet_ntoa'
char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:69:7: error: functions that differ only in their return type cannot be overloaded
u32_t inet_addr(const char *cp);

::38: C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\mingw64\x86_64-w64-mingw32\include\winnt.h  WINSOCK_API_LINKAGE unsigned __LONG32 WSAAPI inet_addr(const char *cp);:

C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\mingw64\x86_64-w64-mingw32\include\winnt.h:147:37:   WINSOCK_API_LINKAGE u_short WSAAPI htons(u_short hostshort);52

^inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h
:111:7: error: functions that differ only in their return type cannot be overloaded
u32_t htonl(u32_t x);

In file included from inet/transportlayer/tcp_lwip/lwip/include\lwip/lwip_tcp.hC:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\mingw64\x86_64-w64-mingw32\include\winnt.hinet/transportlayer/tcp_lwip/lwip/include\lwip/lwip_tcp.h::52:  WINSOCK_API_LINKAGE unsigned __LONG32 WSAAPI inet_addr(const char *cp);147:
:In file included from 
37                                               ^inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/lwip_ip.h

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:112:7: error: functions that differ only in their return type cannot be overloaded
u32_t ntohl(u32_t x);

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:71:7: error: conflicting types for 'inet_ntoa'
char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:111:7: error: functions that differ only in their return type cannot be overloaded
u32_t htonl(u32_t x);

In file included from inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/lwip_ip.h::112:7: error: functions that differ only in their return type cannot be overloaded
u32_t ntohl(u32_t x);

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:112:7: error: functions that differ only in their return type cannot be overloaded
u32_t ntohl(u32_t x);

119:9: C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\mingw64\x86_64-w64-mingw32\include\winsock2.hwarning:: 'IN_CLASSB_HOST' macro redefined [-Wmacro-redefined]
#define IN_CLASSB_HOST      (0xffffffff & ~IN_CLASSB_NET)

inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:111:7: error: functions that differ only in their return type cannot be overloaded
u32_t htonl(u32_t x);

In file included from inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/ip_addr.h:37:
inet/transportlayer/tcp_lwip/lwip/include/ipv4\lwip/inet.h:112:7: error: functions that differ only in their return type cannot be overloaded
u32_t ntohl(u32_t x);

9 warnings and 5 errors generated.
9 warnings and 5 errors generated.
make[1]: *** [Makefile:1762: ../out/clang-debug/src/inet/transportlayer/tcp_lwip/LwipTcpLayer.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1762: ../out/clang-debug/src/inet/transportlayer/tcp_lwip/lwip/core/memp.o] Error 1
9 warnings and 5 errors generated.
make[1]: *** [Makefile:1762: ../out/clang-debug/src/inet/transportlayer/tcp_lwip/TcpLwipConnection.o] Error 1
9 warnings and 5 errors generated.
make[1]: *** [Makefile:1762: ../out/clang-debug/src/inet/transportlayer/tcp_lwip/TcpLwip.o] Error 1
make[1]: Leaving directory '/c/OMNET/omnetpp561/inet4/src'
make: *** [Makefile:7: all] Error 2
"make MODE=debug -j4 all" terminated with exit code 2. Build might be incomplete.

When I try to run the simulation I get the following error:

<!> Error: Cannot load library '../../../src//libINET.dll': The specified module could not be found

End.

Simulation terminated with exit code: 1
Working directory: C:/OMNET/omnetpp561/inet4/examples/inet/nclients
Command line: ../../../../../../Pakhuis/Akademie/MEng/Thesis/Simulasie/WorkSpaces/ThesisSimulations/ThesisSimulations/src/ThesisSimulations.exe -m -n ../../../src;../..;../../../tutorials;../../../showcases --image-path=../../../images -l ../../../src/INET omnetpp.ini

<!> Error: Cannot load library '../../../src//libINET.dll': The specified module could not be found

End.

Simulation terminated with exit code: 1
Working directory: C:/OMNET/omnetpp561/inet4/examples/inet/nclients
Command line: ../../../../../../Pakhuis/Akademie/MEng/Thesis/Simulasie/WorkSpaces/ThesisSimulations/ThesisSimulations/src/ThesisSimulations.exe -m -n ../../../src;../..;../../../tutorials;../../../showcases --image-path=../../../images -l ../../../src/INET omnetpp.ini

Environment variables:
PATH=;C:/OMNET/omnetpp561/inet4/src;C:\OMNET\omnetpp561\omnetpp-5.6.1\bin;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\mingw64\bin;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\usr\bin;;C:/OMNET/omnetpp561/omnetpp-5.6.1/ide/jre/bin/server;C:/OMNET/omnetpp561/omnetpp-5.6.1/ide/jre/bin;C:/OMNET/omnetpp561/omnetpp-5.6.1/ide/jre/lib/amd64;.;C:\OMNET\omnetpp561\omnetpp-5.6.1\bin;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\mingw64\bin;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\usr\local\bin;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\usr\bin;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\usr\bin\site_perl;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\usr\bin\vendor_perl;C:\OMNET\omnetpp561\omnetpp-5.6.1\tools\win64\usr\bin\core_perl;C:\OMNET\omnetpp561\omnetpp-5.6.1;
OMNETPP_ROOT=C:/OMNET/omnetpp561/omnetpp-5.6.1/
OMNETPP_IMAGE_PATH=C:\OMNET\omnetpp561\omnetpp-5.6.1\images

我尝试重新安装 OMNET++ 并使用其他 INET 版本。我也尝试使用 OMNET 4.2.2,但没有成功。

有人可以建议我应该怎么做吗?

亲切的问候本杰明

标签: omnet++lwip

解决方案


TCP_LWIP 功能仅适用于 Linux。在 Windows 上,某些函数与 windows winsock2 库发生冲突。(这就是默认禁用该功能的原因)


推荐阅读