error LNK2019 occurs when running C Caller block in Simulink

3 ビュー (過去 30 日間)
Juyeon Hong
Juyeon Hong 2019 年 7 月 5 日
回答済み: Juyeon Hong 2019 年 8 月 2 日
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.
Capture1.PNG
in AudioDB.cpp
Capture2.PNG
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.
Capture3.PNG
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.
Capture4.PNG
Thank you.

採用された回答

Juyeon Hong
Juyeon Hong 2019 年 8 月 2 日
I found the solution, I didnt change the language mode Matlab language into C language.
It works after I set the language as C.
Thank you.

その他の回答 (1 件)

Chidvi Modala
Chidvi Modala 2019 年 7 月 30 日
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 externalCcode into Simulink. You can refer to this link to see if this helps

Community Treasure Hunt

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

Start Hunting!

Translated by