MATLAB: Mex File problems with 2010a

mexfiles

I have Windows 7, Visual Studio 2010 Express, SDK 7.1, Matlab 2010a and the patch VS2010MEXSupport found in http://www.mathworks.com/support/solutions/en/data/1-D5W493/?solution=1-D5W493 In my work I have matlab 2011a. I have a mex file that works perfectly at work but when I try to run it in the Matlab 2010a I have this error:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\yvals.h(576) : error C2371: 'char16_t' : redefinition; different basic types
c:\program files\matlab\r2010a\extern\include\matrix.h(330) : see declaration of 'char16_t'
Somehow yvals.h does not have
#include <matrix.h>
or somenthing related with that. I try to add the line but the file is protected. I need to work in Matlab 2010a. I really appreciate if somebody helps me. This have been really painful. After downloading all that stuff and Matlab 2010a still does not work 🙁

Best Answer

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