S-Function Builder -- compile all c-files in folder
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I'm using the S-Function Builder block to include custom c-code in a Simulink model. Everything works fine except that I cannot compile all .c-files in a directory without adding them one by one explicitly to the source file list in the "Libraries" pane.
Working Solution:
./TL_s-function/file1.c
./TL_s-function/file1.c
./TL_s-function/file1.c
...
INC_PATH ./TL_s-function/
INC_PATH ./TL_s-function/include/
INC_PATH ./TL_s-function/Parameter/
Desired Solution:
SRC_PATH ./TL_s-function/
INC_PATH ./TL_s-function/
INC_PATH ./TL_s-function/include/
INC_PATH ./TL_s-function/Parameter/
This solution leads to an "error LNK2019: unresolved external symbol" error due to the uncompiled c-files. I thought "SRC_PATH" instructs the mex compiler to compile all c-files in this directory. But it doesn't. Is there any other solution? Thanks.
(I'm using Version 8.1 (R2013.a) on a Windows machine with "Microsoft Software Development Kit (SDK) 7.1" compiler )
0 comentarios
Respuestas (2)
Huihua Zhao
el 11 de Jun. de 2018
I came to a similar problem. It seems that you have to add the directory to "SFCN_DIR" instead. This trick fixes my problem.
0 comentarios
Alexander Tuma
el 26 de Feb. de 2024
As I understand it, adding a directory with SRC_PATH includes this directory into the search for source files. Therefore the source files can be added without preceding path.
So you can add your source files as if they were in your working directory, but you still have to add all of them.
SRC_PATH ./TL_s-function
file1.c
file2.c
0 comentarios
Ver también
Categorías
Más información sobre MATLAB Compiler en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!