error LNK2019 occurs when running C Caller block in Simulink
Show older comments
I made a very simple example of C Caller block to see how it works, but I got link error which I can't find out what the reason is.
in AudioDB.h
I created FuncTest() in C code.

in AudioDB.cpp

in Simulation Target menu of Configuration Parameters dialog,
I added like below
- Header file : #include "AudioDB.h"
- Source files : AudioDB.cpp
I put the .h, cpp files in the same directory with the model file, so I didnt add anything in the include directories item.
then I made parsing custom coded in model successfully, and tried to hook this function up with C Caller block.

but when i start compiling/running the model, I got a link error regarding external interface like below, I have no idea what I should do to solve this error.

Thank you.
Accepted Answer
More Answers (1)
Chidvi Modala
on 30 Jul 2019
1 vote
I am assuming that you included header file in the “Insert Custom Code in generated” section and
source code in the “Additional build information” section inside Configuration Parameters>>Simulation
Target.
From my understanding, you would like to use your source code inside Simulink. Include the source file and the header file as shown ‘AudioDB.cpp’(including quotes) #include "AudioDB.h". I also assume that you know that the C Caller block integrates your external C code into Simulink. You can refer to this link to see if this helps
Categories
Find more on Integrate C Code Using C Caller Blocks 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!