Borrar filtros
Borrar filtros

ECo "Undefined symbols for architecture x86_64"

3 visualizaciones (últimos 30 días)
Chip
Chip el 17 de Ag. de 2015
Respondida: Sainath Varikuti el 19 de Ag. de 2015
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 comentario
Walter Roberson
Walter Roberson el 17 de Ag. de 2015
You specifically call upon State and Elements in the code: what are you expecting those to be?

Iniciar sesión para comentar.

Respuestas (1)

Sainath Varikuti
Sainath Varikuti el 19 de Ag. de 2015
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

Categorías

Más información sobre External Language Interfaces en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by