简体   繁体   中英

why am I getting the error “Invalid MEX-file”, while the file is in the current folder?

This is my current folder:
在此处输入图片说明
and here is the gateway function written in the file mx_minimum_power.cpp :

#include <math.h>
#include <complex>
#include <iostream>
#include "mex.h"
#include "matrix.h"
#include "armaMex.hpp"

using std::complex;
using std::cout;
using std::endl;


/* The gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    double *arraysizePtr = NULL;
    arraysizePtr = mxGetPr(prhs[9]);
    const int arraysize = (int)*arraysizePtr;
    const int matrixDimention = 3;
    float *inMatrixA11 = (float *)mxGetPr(prhs[0]);
    float *inMatrixA12_real = (float *)mxGetPr(prhs[1]);
    float *inMatrixA12_imag = (float *)mxGetPr(prhs[2]);
    float *inMatrixA13_real = (float *)mxGetPr(prhs[3]);
    float *inMatrixA13_imag = (float *)mxGetPr(prhs[4]);
    float *inMatrixA22 = (float *)mxGetPr(prhs[5]);
    float *inMatrixA23_real = (float *)mxGetPr(prhs[6]);
    float *inMatrixA23_imag = (float *)mxGetPr(prhs[7]);
    float *inMatrixA33 = (float *)mxGetPr(prhs[8]);
    Mat <complex<float>> A(matrixDimention, matrixDimention);
    Mat <complex<float>> EigenVectors(matrixDimention, matrixDimention);
    Col <float> Eigenvalues(matrixDimention);
    int i = 0;
    for (i = 0; i < arraysize; i++)
    {
        A.at(0, 0) = complex<float>(inMatrixA11[i],0);
        A.at(1, 1) = complex<float>(inMatrixA22[i],0);
        A.at(2, 2) = complex<float>(inMatrixA33[i], 0);
        A.at(0, 1) = complex<float>(inMatrixA12_real[i], inMatrixA12_imag[0]);
        A.at(1, 0) = complex<float>(inMatrixA12_real[i], -inMatrixA12_imag[0]);
        A.at(0, 2) = complex<float>(inMatrixA13_real[i], inMatrixA13_imag[0]);
        A.at(2, 0) = complex<float>(inMatrixA13_real[i], -inMatrixA13_imag[0]);
        A.at(1, 2) = complex<float>(inMatrixA23_real[i], inMatrixA23_imag[0]);
        A.at(2, 1) = complex<float>(inMatrixA23_real[i], -inMatrixA23_imag[0]);
        eig_sym(Eigenvalues, EigenVectors, A);
    }
}

I have build the mx_minimum_power.mexw64 file through the following code:

mex -g mx_minimum_power.cpp blas_win64_MT.lib lapack_win64_MT.lib
Building with 'Microsoft Visual C++ 2013 Professional'.
MEX completed successfully.  

and as you see all both of the files Arii2011_modified.m and mx_minimum_power.mexw64 are in the current directory.
but when I run the following function:

[Ps,Pd,Pv,ThetaMean,Variance] = Arii2011_Modified(MMA.Data.C11,MMA.Data.C12_imag,MMA.Data.C12_real,MMA.Data.C13_imag,MMA.Data.C13_real,MMA.Data.C22,MMA.Data.C23_imag,MMA.Data.C23_real,MMA.Data.C33);  

in the command window, I get the error:

Invalid MEX-file 'D:\thesis library.Data\ALOS-PALSAR 12x2\San Francisco L
12x2\mx_minimum_power.mexw64': The specified module could not be found.  

I guess the error is somehow related to armadillo , because if I convert lines 29-45 of the mx_minimum.cpp to comments and then rebuild the mx_minimum_power.mexw64 , I will not get such error and the MEX file is recognized


This is what I have found through inspecting the mx_minimum_power.mexw64 file in dependency walker.

在此处输入图片说明

我将文件blas_win64_MT.dlllapack_win64_MT.dll添加到当前文件夹中,问题得到了解决,这要归功于@suever的评论

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM