Borrar filtros
Borrar filtros

S-Function Builder -- compile all c-files in folder

8 visualizaciones (últimos 30 días)
simdens
simdens el 14 de Sept. de 2015
Respondida: Alexander Tuma el 26 de Feb. de 2024
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 )

Respuestas (2)

Huihua Zhao
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.

Alexander Tuma
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

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by