Redifinition of mxArray: error C2371

In the linking step I am getting this error:
c:\program files (x86)\matlab\r2012b\extern\include\matrix.h(301) : error C2371: 'mxArray' : redefinition; different basic types c:\program files (x86)\matlab\r2012b\simulink\include\simstruc.h(474) : see declaration of 'mxArray'
I am using VS2010 C++ compiler. The two header files seem are matlab and simulink includes, so I'm not sure why they don't play nice together.

댓글 수: 4

Carlos
Carlos 2013년 9월 3일
I have the same problem while I'm generating code with Simulink Coder. I don't see any answer, but have you resolved this problem?
Kaustubha Govind
Kaustubha Govind 2013년 9월 3일
Is this an S-function that you are trying to compile using Visual Studio? What happens when you use the "mex" command in MATLAB?
Anthony Poulin
Anthony Poulin 2014년 7월 3일
I have also the same problem. I have no problem when I compile my sfunction with visual studio 2010 C++ compiler. But I have the error when I try to generate code from my model whichn includes this S-function. Any idea?
Anthony Poulin
Anthony Poulin 2014년 7월 7일
편집: Anthony Poulin 2014년 7월 7일
Anyone has solution? I am blocked...

댓글을 달려면 로그인하십시오.

답변 (1개)

Anthony Poulin
Anthony Poulin 2014년 7월 18일

1 개 추천

I find solution, it happens because "simstruct.h" (the C s-function hearder) does not include the same headers when compiling in mexw32 (for simulation) or when compiling a model with simulink coder. It was explained in the link bellow:
My problem comes from functions include in "matrix.h", (which is not include when compiling with simulink coder), so the solution was to use only functions include both in matrix.h and rt_matrx.h

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

질문:

2013년 8월 27일

답변:

2014년 7월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by