空的MEX文件崩溃

时间:2012-01-12 10:47:51

标签: c matlab mex

我正在尝试运行我创建和编译的mex文件。 但是,当我尝试将该mex文件与消息一起使用时程序崩溃:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000001 in ?? ()

为了尝试和调试问题,我完全清除了文件,只留下:

#include "mex.h"
#include "lsm_fast_marching_method.h" 

/* Input Arguments */
#define PHI                    (prhs[0])
#define BACKGROUND                 (prhs[1])

/* Output Arguments */
#define SKELETON          (plhs[0])


void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
return;
}

标题文件内容:

#ifndef included_fast_marching_method_h
#define included_fast_marching_method_h

#ifdef __cplusplus
extern "C" {
#endif

int computeExtensionFields2d(
  double *distance_function,
  double **extension_fields,
  double *phi,
  double *mark,
  double **source_fields,
  int num_extension_fields,
  int spatial_derivative_order,
  int *grid_dims,
  double *dx);

int computeExtensionFields2d_WithMaxVal(
  double *distance_function,
  double **extension_fields,
  double *phi,
  double *mark,
  double **source_fields,
  int num_extension_fields,
  int spatial_derivative_order,
  int *grid_dims,
  double *dx,
  double max_value);
int computeDistanceFunction2d(
  double *distance_function,
  double *phi,
  double *mark,
  int spatial_derivative_order,
  int *grid_dims,
  double *dx);
int solveEikonalEquation2d(
  double *phi,
  double *speed,
  double *mask,
  int spatial_derivative_order,
  int *grid_dims,
  double *dx);
int computeExtensionFields3d(
  double *distance_function,
  double **extension_fields,
  double *phi,
  double *mask,
  double **source_fields,
  int num_extension_fields,
  int spatial_derivative_order,
  int *grid_dims,
  double *dx);
int computeDistanceFunction3d(
  double *distance_function,
  double *phi,
  double *mask,
  int spatial_derivative_order,
  int *grid_dims,
  double *dx);
int solveEikonalEquation3d(
  double *phi,
  double *speed,
  double *mask,
  int spatial_derivative_order,
  int *grid_dims,
  double *dx);

int doHomotopicThinning(
  double *thinned_img,
  double *phi,
  double *background,
  int *grid_dims);

bool isSimplePoint(int* grid_point_status, double* background, int* grid_idx, int neighbors[][3], 
                   int* grid_dims);

#ifdef __cplusplus
}
#endif

#endif

但程序仍然因同样的错误崩溃!!我尝试在Matlab(GDB)之外的调试器上运行它,它仍然会崩溃同样的消息..

我使用的是linux 64bit系统。

知道这是怎么回事吗?

提前致谢。

0 个答案:

没有答案