How to prevent #include "rt_nonfinite.h" with extern "C" in C++ generated Code

25 ビュー (過去 30 日間)
Moritz Oberacker
Moritz Oberacker 2025 年 1 月 20 日 8:56
コメント済み: 埃博拉酱 2025 年 1 月 21 日 14:18
Hi everyone
I use the Embedded Coder to generate C++ Code from a Simulink Model. Unfortunately, the generated Code includes some headerfiles as extern "C":
extern "C"
{
#include "rt_nonfinite.h"
}
extern "C"
{
#include "rtGetInf.h"
}
extern "C"
{
#include "rtGetNaN.h"
}
The problem with this is, that some of these headers include other headers themselfes, like in rt_nonfinite.h:
#include <stddef.h>
which I don't want to import as C. Also almost all contents of the headers are enclosed with a
#ifdef __cplusplus
extern "C"
{
#endif
which makes the extern "C" around the include obsolete as I understand it.
Is there a way to prevent embedded Coder from including headerfiles with extern "C"?
  1 件のコメント
埃博拉酱
埃博拉酱 2025 年 1 月 21 日 14:18
Importing standard C library headers with extern "C" usually doesn't cause much of a problem. Is there any particular reason why you don't want to import as C?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by