
Why does generating C code for a "CAN Log" block throw the error "fatal error: dlfcn.h: No such file or directory" in MATLAB R2024b?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 11 Jul 2025
Edited: MathWorks Support Team
on 21 Jul 2025
I want to generate C code for a model with a "CAN Log" block to log signals in MATLAB R2024b, however, the error message below is thrown. Why is this?
fatal error: dlfcn.h: No such file or directory
Accepted Answer
MathWorks Support Team
on 21 Jul 2025
Edited: MathWorks Support Team
on 21 Jul 2025
The reason for this is that the "CAN Log" block is intended solely for host-based analysis and does not support code generation for deployment to target hardware.
As a workaround for logging signals on targets such as Arduino and Rasperry Pi, consider using "Simulink Data Inspector" while running the model in the "Model and Tune" mode.
First, instead of clicking on "Build, Deploy and Start", instead select the "Monitor & Tune" mode. This deploys the model and communicates with the deployed model on your hardware board during runtime.
For more information on this step, please refer to the documentation on signal monitoring and parameter tuning.
Next, to enable Simulink Data Inspector, you can select a signal and click the Wi-Fi icon that appears:

For more information on this step, please refer to the following documentation on data logging.
0 Comments
More Answers (0)
See Also
Categories
Find more on Code Generation and Deployment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!