# Adding lwip to WIN32-MingW demo

**URL:** <https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274>\
**Category:** Libraries\
**Created:** [April 22, 2023, 3:38pm UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274 "2023-04-22T15:38:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marbro1965](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/marbro1965/32/3463_2.png) [@Marbro1965](https://forums.freertos.org/u/Marbro1965)\
**Post date:** [April 22, 2023, 3:38pm UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/1 "2023-04-22T15:38:47Z")

</div>

Hi,

Is there an easy way to add lwip to the Win32-MingW project?  
Alternatively, following the link Adding the TCP/IP Source Files to an RTOS Project,  
I got stuck on compiling problems.  
Best

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [April 22, 2023, 7:50pm UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/2 "2023-04-22T19:50:54Z")

</div>

The MingW and Visual Studio projects both use the same kernel port. There are [several FreeRTOS+TCP projects that use WinPCap](https://freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html) to get raw access to the Ethernet. You could use the [same WinPCap driver](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/main/source/portable/NetworkInterface/WinPCap) as a starting point of an lwIP port.

---

<div class="post-metadata">

**Author:** ![Marbro1965](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/marbro1965/32/3463_2.png) [@Marbro1965](https://forums.freertos.org/u/Marbro1965)\
**Post date:** [April 23, 2023, 10:35am UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/3 "2023-04-23T10:35:01Z")

</div>

Hi,  
Thank you very much.  
I followed indication. Start from a rtos project working, and I choose win32-mingw then added the tcp directories and files as indicated ( the same files in the visual studio tcp working project) but it not compiles. Win32 must not be defined and I should tell that I am using gcc compiler…  
Maybe the right place where to tell is in pcap.h file but what to do is for me too hard to do. That’s why I asked for a Mingw tcp working project.  
Better was to have a lwip working under windows simulator as stm uses lwip.  
Best.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [April 25, 2023, 8:49am UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/4 "2023-04-25T08:49:24Z")

</div>

Have you also see [these demo’s](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo) with FreeRTOS and FreeRTOS+TCP?

It uses the [FreeRTOS TCP/IP stack](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP) (not lwIP). You you can run it from Visual-C

> …as stm uses lwip

+TCP also supports all STM devices:  
[STM32Fxx](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/main/source/portable/NetworkInterface/STM32Fxx)  
[STM32Hxx](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/tree/main/source/portable/NetworkInterface/STM32Hxx)

A new [unified STM driver](https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/pull/804) is being developed right now.

If you have any further questions, you can ask them here.  
Thanks

---

<div class="post-metadata">

**Author:** ![Marbro1965](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/marbro1965/32/3463_2.png) [@Marbro1965](https://forums.freertos.org/u/Marbro1965)\
**Post date:** [April 25, 2023, 1:30pm UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/5 "2023-04-25T13:30:04Z")

</div>

Hi,  
Hein Tibosch.  
I followed the link "TCP\_Networking\_Tutorial\_Adding\_Source\_Files "  
to add TCP/IP files to my Win32-MingW project.  
Unfortunately I am not able to make them compile.  
At the end of compilation I have:

c:\mingw\include\stdio.h:345:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘ **attribute** ’ before ‘\_\_mingw\_\_snprintf’

I think I miss some define to tell the system that new files must be compiled with Mingw but I do not know

what to do and where to do.

Best regards

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [April 25, 2023, 5:29pm UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/6 "2023-04-25T17:29:12Z")

</div>

See this thread: [Build demo TCP project using MinGW - #9 by rum](https://forums.freertos.org/t/build-demo-tcp-project-using-mingw/11309/9)

---

<div class="post-metadata">

**Author:** ![Marbro1965](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/marbro1965/32/3463_2.png) [@Marbro1965](https://forums.freertos.org/u/Marbro1965)\
**Post date:** [April 26, 2023, 4:55am UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/7 "2023-04-26T04:55:41Z")

</div>

Hello Richard Barry,

unfortunately it does not help, but I found that **MINGW32**  
is defined.  
Best Regards

---

<div class="post-metadata">

**Author:** ![Marbro1965](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/marbro1965/32/3463_2.png) [@Marbro1965](https://forums.freertos.org/u/Marbro1965)\
**Post date:** [April 26, 2023, 9:11am UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/8 "2023-04-26T09:11:47Z")

</div>

Hello Richard,

I think you could help me.

I follow tutorial to add the TCP/IP support to my project.

First I add all the source file as indicated in point 1.  
At point 2. I should add NetworkInterface.c and If I want to run Windows Simulator I should add that in WinPCap.  
At point 3 I add BufferAllocation\_c  
At point 4 the compiler, which I am using GCC  
At point 5 FreeRTOSIPConfig.c, which I choose from FreeRTOS\_Plus\_TCP\_Echo\_Qemu\_mps2

In this way it does not work.

Does anyone have success in importing TCP/IP support to MingW project and provide some indication?

Best Regards

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [May 2, 2023, 3:36am UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/9 "2023-05-02T03:36:05Z")

</div>

> [@Marbro1965](#):
>
> In this way it does not work.

Can you share the complete compiler output?

---

<div class="post-metadata">

**Author:** ![Marbro1965](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/marbro1965/32/3463_2.png) [@Marbro1965](https://forums.freertos.org/u/Marbro1965)\
**Post date:** [May 4, 2023, 6:30pm UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/10 "2023-05-04T18:30:26Z")

</div>

It compiles, only there is incompatibility in StreamBuffer\_t struct definition.  
It is defined in two different files, one in FreeRTOS and one in FreeRTOS TCP plus, I do not know how to fix.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [May 8, 2023, 5:27am UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/11 "2023-05-08T05:27:16Z")

</div>

How did you determine this incompatibility? Unless you share some code or output or something which helps me understand the problem you are facing, it is hard for me to provide any meaningful suggestion. Try to share your code if you can.

---

<div class="post-metadata">

**Author:** ![EyalG](https://avatars.discourse-cdn.com/v4/letter/e/b782af/32.png) [@EyalG](https://forums.freertos.org/u/EyalG)\
**Post date:** [April 4, 2024, 9:52pm UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/12 "2024-04-04T21:52:39Z")

</div>

Hello @htibosch, I’m looking for a driver for the H5 that will allow me to port an H7 project that is based on FreeRTOS-Plus-TCP & FreeRTOS AWS Libs to a new HW we have that is H563 based.  
Is there any place I can find such a driver?

---

<div class="post-metadata">

**Author:** ![skptak](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/skptak/32/3981_2.png) [@skptak](https://forums.freertos.org/u/skptak)\
**Post date:** [April 5, 2024, 12:10am UTC](https://forums.freertos.org/t/adding-lwip-to-win32-mingw-demo/17274/13 "2024-04-05T00:10:40Z")

</div>

@EyalG Please keep your conversation about this topic in your existing [Forum Thread](https://forums.freertos.org/t/freertos-plus-tcp-porting-to-stm32h5/19719/5).

It will make it harder for future users to find the relevant information if this is discussed in this un-related thread.
