ECo "Undefined symbols for architecture x86_64"

1 次查看(过去 30 天)
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 中查找有关 External Language Interfaces 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by