Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Mex compiling problem

Subject: Mex compiling problem

From: Airballman

Date: 17 May, 2010 07:11:06

Message: 1 of 2

Hi everyone,

I'm curretly working on Sonar Image processing and I would need to process the Zernicke moments of an image. I found some source code on the Internet here, and I use the mb_zernike.m function. However, this function calls mb_Znl which is a c++ file on the website.
I asume the guy compiled it to create .mex which would be understandable by matlab.

Here is the file header :
--------------------------------------------------
 /*/////////////////////////////////////////////////////////////////////////
//
//
// mb_Znl.cpp
//
//
// Michael Boland
// 09 Dec 1998
//
// Revisions:
//
/////////////////////////////////////////////////////////////////////////*/


#include "mex.h"
#include "matrix.h"
#include "math.h"
#include "complex.h"


#define row 0mex
#define col 1

#ifndef PI
#define PI 3.14159265358979323846
#endif
--------------------------------------------------

So I tried to compile the file using
 mex -c mb_Znl.cpp

but It keeps returning errors :
--------------------------------------------------
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
mb_Znl.cpp:
Error E2102 mb_Znl.cpp 55: Cannot use template 'complex<T>' without specifying specialization parameters in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2040 mb_Znl.cpp 55: Declaration terminated incorrectly in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2102 mb_Znl.cpp 56: Cannot use template 'complex<T>' without specifying specialization parameters in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2040 mb_Znl.cpp 56: Declaration terminated incorrectly in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2380 mb_Znl.cpp 64: Unterminated string or character constant in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2121 mb_Znl.cpp 65: Function call missing ) in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2380 mb_Znl.cpp 69: Unterminated string or character constant in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2379 mb_Znl.cpp 71: Statement missing ; in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2451 mb_Znl.cpp 113: Undefined symbol 'sum' in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2451 mb_Znl.cpp 118: Undefined symbol 'Vnl' in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2285 mb_Znl.cpp 134: Could not find a match for 'conj<T>(undefined)' in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2285 mb_Znl.cpp 146: Could not find a match for 'real<T>(undefined)' in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
Error E2285 mb_Znl.cpp 147: Could not find a match for 'imag<T>(undefined)' in function mexFunction(int,mxArray_tag * *,int,const mxArray_tag * *)
*** 13 errors in Compile ***
 
  C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Compile of 'mb_Znl.cpp' failed.
--------------------------------------------------

As I am absolutely not confident with c++ nor with the mex function I ask for help. What could I do to solve the problem?

As far as I am concerned, It seems like the complex library is not taken into consideration as the errors begins with the creation of complex variables :

--------------------------------------------------
  complex sum = 0.0 ; /* Accumulator for complex moments */
  complex Vnl = 0.0 ; /* Inner sum in Zernike calculations */
--------------------------------------------------

I hope someone could help me on this, I've been trying for 3 days without any good :'(


Feel free to ask for information if needed ! Thx a lot

Airball

Subject: Mex compiling problem

From: mauricio calzada

Date: 5 Jul, 2010 19:47:03

Message: 2 of 2

I had the same problem.
uninstalling and installing matlab again solve the issue.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us