ECo "Undefined symbols for architecture x86_64"

조회 수: 2 (최근 30일)
Chip
Chip 2015년 8월 17일
답변: Sainath Varikuti 2015년 8월 19일
I'm trying to compile a mex file and I got this error:
>> mex S-Function/coordinate_converter.cpp
Building with 'Xcode Clang++'.
Error using mex
Undefined symbols for architecture x86_64:
"State(double, Vector const&, double)", referenced from:
mdlOutputs(SimStruct_tag*, int) in coordinate_converter.o
"Elements(double, Vector const&)", referenced from:
mdlOutputs(SimStruct_tag*, int) in coordinate_converter.o
"Vector::Vector(int)", referenced from:
mdlOutputs(SimStruct_tag*, int) in coordinate_converter.o
"Vector::~Vector()", referenced from:
mdlOutputs(SimStruct_tag*, int) in coordinate_converter.o
"Vector::operator=(Vector const&)", referenced from:
mdlOutputs(SimStruct_tag*, int) in coordinate_converter.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My mdlOutputs look like this:
static void mdlOutputs(SimStruct *S, int_T tid)
{
//Local variables
Vector y_in(6);
Vector y_out(6);
//Get parameters
real_T *Y_IN = (real_T *) ssGetInputPortRealSignal(S, 0);
for(int_T i = 0; i < 6; i++) y_in(i) = Y_IN[i];
//Computation
if(int(*mxGetPr(ssGetSFcnParam(S, 1))) == 1) // Cartesian > Keplerian
y_out = Elements(GM_Earth, y_in);
else if(int(*mxGetPr(ssGetSFcnParam(S, 1))) == 2) // Keplerian > Cartesian
y_out = State(GM_Earth, y_in, 0.0);
else
ssSetErrorStatus(S, "Wrong parameter, should be 1 or 2");
real_T *Y_OUT = ssGetOutputPortRealSignal(S, 0); //Output
for(int_T i = 0; i < 6; i++) Y_OUT[i] = y_out(i);
}
I would really appreciate if you could help me with this. Thank you so much.
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 8월 17일
You specifically call upon State and Elements in the code: what are you expecting those to be?

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

답변 (1개)

Sainath Varikuti
Sainath Varikuti 2015년 8월 19일
Hi,
When performing mex, you have to include the source file with elements and state methods. You may refer to the following documentation page.
Regards, Sainath

카테고리

Help CenterFile Exchange에서 C Matrix API에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by