This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] EK-TM4C129EXL:将 tirtos_tivac_2_16_01_14\packages\examples\tools 与 MSYS2配合使用时适用于 Windows

Guru**** 2457760 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1487708/ek-tm4c129exl-compling-tirtos_tivac_2_16_01_14-packages-examples-tools-for-windows-with-msys2

器件型号:EK-TM4C129EXL

工具与软件:

使用 MSYS2 gcc 编译示例项目会导致以下错误:

$ gcc tcpSendReceive.c -o tcpSendReceive -lws2_32.
在 tcpSendReceive.c:54包含的文件中:
sockets.h:55:21:错误:"inet_pton"的静态声明跟在非静态声明之后
55 | static __inline int inet_pton (int af、const char * src、void * dst)
|^~~~~~~~~
在包含在 sockets.h:36中的文件中:
C:/msys64/ucrt64/include/ws2tcpip.h:431:32:注意:前一个"inet_pton"声明(类型为"int")
(int、const char *、void *)'{aka 'int (int、const char *、void *)'}
431 | WINSOCK_API_INCENTATION INT WSAAPI InetPtonA (INT Family、LPCSTR pStringBuf、PVoid pAddr);

我注释掉 套接字.h 中的 inet_pton 函数时、程序将生成。 不过、我宁愿不需要这样做。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    [quote userid="646391" url="~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1487708/ek-tm4c129exl-compling-tirtos_tivac_2_16_01_14-packages-examples-tools-for-windows-with-msys2当我注释掉 插槽.h 中的 inet_pton 函数时、程序就会生成。 但是我不想这样做。[/报价]

     抱歉、我不是这个工具的开发人员、也不需要为 GCC 重建它、但 当我阅读 socket.h 文件时、它包含以下注释。 您无法在 Windows 中按原样使用可执行文件有什么原因吗? 我强烈建议您按原样使用执行。 我还发现一个有关 stackoverflow 的类似问题。  https://stackoverflow.com/questions/37987479/instead-of-linking-with-lws2-32-which-library-is-missing

    /*
    * ======== sockets.h ========
    *
    * Simple (incomplete) compatibility header file to make it easier to
    * write portable sockets-based C programs for Linux and Windows.
    * This is meant to be just good enough for the simple NDK examples.
    */