Effacer les filtres
Effacer les filtres

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

8 vues (au cours des 30 derniers jours)
simdens
simdens le 14 Sep 2015
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 )

Réponses (2)

Huihua Zhao
Huihua Zhao le 11 Juin 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 le 26 Fév 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

Catégories

En savoir plus sur Schedule Model Components dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by