問題タブ [s-function]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
0 に答える
322 参照

c - MATLAB の複数定義エラーで C S-Function をコンパイルする

S-Function ビルダー ブロックと minGW 64 ビット コンパイラを使用して、MATLAB Simulink でさまざまな C-Function をコンパイルしようとしています。コードの構文エラーは、生産されて何年も稼働している ECU のコードであるため、あり得ません。

2 つのファイルで次のエラー メッセージが表示され続けます。

...example.obj:example.c:(.text+0x0): 複数の「example」の定義

...example.obj:example.c:(.text+0x0): 最初にここで定義

「最初の定義」と同じ位置を参照しているため、エラーは私を混乱させます。他の関数では位置 ( .text+0x17a) です。

同じ問題に直面した人や、それを修正する方法を考えている人はいますか? コンパイラのバグでしょうか?

ドイツからのご挨拶、ジョナサン

0 投票する
1 に答える
886 参照

matlab - S-Function が mdlInitializeSizes() のみを実行し、mdlOutputs()、mdlStart() などを実行しないのはなぜですか?

#define S_FUNCTION_NAME myfunction_sFun

#定義 S_FUNCTION_LEVEL 2

#MDL_INITIAL_SIZES を定義

#MDL_INITIALIZE_SAMPLE_TIMES を定義

#include "tmwtypes.h"

#include "simstruc_types.h"

#include "mex.h"

#include "simstruc.h"

void mdlInitializeSizes(SimStruct *S)

{

}

void mdlInitializeSampleTimes(SimStruct *S)

{

}

#MDL_OUTPUTS の定義

#ifdef MDL_OUTPUTS

void mdlOutputs(SimStruct *S, int_T tid)

{

}

#endif

#MDL_START を定義

#ifdef MDL_START

void mdlStart(SimStruct *S)

{

}

#endif

void mdlTerminate(SimStruct *S){}

/ =============================

  • 必要な S-Function トレーラー *

    ============================= /

#ifdef MATLAB_MEX_FILE /* このファイルは MEX ファイルとしてコンパイルされているか? */

#include "simulink.c" /* MEX ファイル インターフェイス メカニズム */

#そうしないと

#include "cg_sfun.h" /* コード生成登録関数 */

#endif