フィルターのクリア

procedure multiply defined error in polyspace code prover

4 ビュー (過去 30 日間)
srinivasan kandaswamy
srinivasan kandaswamy 2015 年 10 月 16 日
コメント済み: Alexandre De Barros 2015 年 10 月 22 日
Hello, In Polyspace code prover, when verifying cross-files ANSI C compliance getting procedure multiply defined error for inline functions. Example: INLINE function1() { ... ... } Error:procedure function1 multiply defined.
How to solve this?
Thanks and Regards, Srinivasan K.

回答 (1 件)

Alexandre De Barros
Alexandre De Barros 2015 年 10 月 20 日
Hello Srinivasan,
Can you confirm that the function is defined in a header file ?
Functions that are defined in a header file will be indeed "multiply defined" since this header file can be included in different source files.
Now, when such a function is inlined (using the "inline" qualifier), Polyspace will not give this error. So my question is : does the macro INLINE is really defined as "inline" ? If for example it is defined to nothing, then the function function1 is not an genuine inlined function.
Best regards,
Alexandre
  2 件のコメント
srinivasan kandaswamy
srinivasan kandaswamy 2015 年 10 月 21 日
Hi Alexandre, 1.Yes,the function is defined in header file and this header file is included in more places. 2.INLINE is defined as #define INLINE __inline
Thanks & Regards, Srinivasan K.
Alexandre De Barros
Alexandre De Barros 2015 年 10 月 22 日
Hi,
inline is the official keyword in C++ and C99 to inline a function.
__inline is a vendor-specific keyword. Polyspace will only recognize the official keyword, so I suggest you to use a macro definition to map __inline to inline.
If you're using Polyspace in command line, the option is
-D__inline=inline
If you're using the GUI, in your project go to Macros (in Target & Compiler) and add a new preprocessor definition :
__inline=inline
Best regards,
Alexandre

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by