Undefined symbols for architecture x86_64 error. Mex S-Function
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Okay, so I am far from an experienced coder, and am helping my professor with a project. I received a collection of MATLAB functions that are represented in Simulink. I had to create new mex files, which I thought worked at first, but when I would run it through Simulink, I was coming up with an "invalid sizes vector" error (block error). The original code is in c, and I'm using Visual Studios as my compiler. The c-code is an S-function within Simulink as well. After researching a bit, I found that I had to add
#ifdef MATLAB_MEX_FILE
#include "simulink.c"
#else
#include "cg_sfun.h"
#endif
to the end of all mex S-functions. Once I did this, I tried re-creating the mex files and got this error:
>> mex Core_Neutronics.c
Undefined symbols for architecture x86_64:
"_dgesvd_", referenced from:
_mdlOutputs in Core_Neutronics.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mex: link of ' "Core_Neutronics.mexmaci64"' failed.
Error using mex (line 206)
Unable to complete successfully.
------------------------------------------------ ------------------------------------------------
My code consists of two lines where dgesv is used.
/* DGESV prototype */
extern void dgesv_( int* n, int* nrhs, double* a, int* lda, int* ipiv, double* b, int* ldb, int* info);
Then later,
dgesv(&matrix_size, &brnhs, a, &matrix_size, ipvt, b, &matrix_size, &info);
I notice that there is an underscore in the first line, but not later on in the second. Even when this is changed, the same error still occurs. Does anyone know what's going on? I know that I don't have a bunch of detail for my code, but I was hoping someone could point me in the right direction. Also, I do have these libraries called out in Matlab
/* C Header for the Simulink interface */
#include "simstruc.h"
/* Other C Headers */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <math.h>
Could it be that I don't have these libraries installed somehow? (If not, how do I install these?)
0 commentaires
Réponses (1)
Muruganandham Subramanian
le 20 Fév 2014
Try using
dgesv(matrix_size, brnhs, a, matrix_size, ipvt, b, matrix_size, info);
Because, when you are passing as an pointer variable, it processes the address
Voir également
Catégories
En savoir plus sur Simulink Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!