MATLAB Answers

Why do I get an error regarding "socketfuncs.h" when I try to build my model that contains a UDP block from the Simulink Real-Time library?

23 views (last 30 days)
I have a model that contains a UDP Send or UDP Receive block. I want to deploy this model to my hardware, but I receive the following error:
ERROR: fatal error: socketfuncs.h: No such file or directory
How to resolve this error?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Sep 2021
Edited: MathWorks Support Team on 16 Sep 2021
This error appears when your model contains UDP blocks from the Simulink Real-Time (SLRT) library, but you are targeting a non-SLRT environment language compiler such as 'grt.tlc', 'ert.tlc', 'sldrt.tlc', etc.
If your target hardware is indeed a Simulink Real-Time target (Speedgoat), go to Model Configuration Parameters > Code Generation and choose 'slrt.tlc' (R2020a and earlier) or 'slrealtime.tlc' (R2020b or later) from the  list as the System Target File.
If your target hardware is NOT Simulink Real-Time, you need to remove these UDP blocks from the model and use blocks from the library that are appropriate for your target.
(1) For deployment to a Windows-based platform, use the UDP blocks from DSP System Toolbox or Embedded Coder Toolbox:
(2) For Simulink Desktop Real-Time, use the Packet I/O or Stream I/O blocks:
(3) For supported hardware such as Raspberry Pi, Arduino, BeagleBone, etc, use the UDP blocks from the corresponding hardware support package:

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!