Thanks, your answer point me to look in the right direction, know I understand the problem but did not give the answer. Here is what I found that work. It is the 14th post by Zdenek Kalal in this matlab discussion http://www.mathworks.com/matlabcentral/newsreader/view_thread/281754 I am going to copy it to save people that find this post some time.
" This fix,
#ifdef _CHAR16T
#define CHAR16_T
#endif
worked fine for me, but only if I moved the MEX header (mex.h) at the bottom of all includes in my C file.
This didn't work:
#ifdef _CHAR16T
#define CHAR16_T
#endif
#include "mex.h"
#include "cv.h"
but this worked fine:
#include "cv.h"
#ifdef _CHAR16T
#define CHAR16_T
#endif
#include "mex.h"
Zdenek "
I did the same, but I add at the end #include "matrix.h", since that was the source of my error. My code looks like:
#include <stdlib.h>
#include <vector>
#include <queue>
#include <limits>
#include <utility>
#include <map>
#include <assert.h>
#ifdef _CHAR16T
#define CHAR16_T
#endif
#include "mex.h"
#include "matrix.h"
Maider