How to include libraries for sfunction?

Hello,
I need to get run a C sfunction some libraries like stdio.h and stdlib.h.
I tried to copy that libraries in the current path. But that libraries call other libraries and I get errors compilling (mex) the C sfunction.
How can I include all libraries which i need? I am a Beginner Thanks a lot

답변 (1개)

Nick Sarnie
Nick Sarnie 2017년 9월 7일

0 개 추천

Hi Mario,
The easiest way to include custom libraries in C S-Functions is to use the S-Function Builder block, which is located in the Library Browser under Simulink>User-Defined Functions. On the Libraries tab of the S-Function Builder UI, you can specify the custom headers and library files to include.

댓글 수: 3

Mario Frischmann
Mario Frischmann 2017년 9월 7일
Hi Nick, thank you very much for your reply. I allready did that. But I need the libaries also in the same directory as the sfunction is, do I? So I need the file (for example: stdio.h) in this directory. But stdio.h has some other includes in his file and when i want to mex the sfucntion i get errors that that includes can't be found.
I hope you can help me.
Thanks for your patience
Nick Sarnie
Nick Sarnie 2017년 9월 7일
편집: Nick Sarnie 2017년 9월 7일
Hi Mario,
You shouldn't need to copy all of the system library headers like stdio.h to the local directory. I recommend using the angle brackets, < and >, to specify system library headers. You can use
#include <stdio.h>
in the "Includes" section, which will search the standard system header locations. If it is a custom library header, you can store it in the current directory and use quotes instead:
#include "myHeader.h"
For custom library files, you can specify the location to the files in the "Library/Object/Source Files" section.
Mario Frischmann
Mario Frischmann 2017년 11월 20일
Hi Nick,
thank you for your help. It worked perfectly and I unterstand it now.
Can I also include libraries which are stored on the Raspberry Pi 3?
Like for example: #include "/home/pi/wiringPi/wiringPi/wiringPi.c" ??
Thanks in advance

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

질문:

2017년 9월 4일

댓글:

2017년 11월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by