Mex File problems with 2010a

조회 수: 2 (최근 30일)
Maider Marin
Maider Marin 2011년 7월 2일
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 :(

채택된 답변

Maider Marin
Maider Marin 2011년 7월 2일
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
  댓글 수: 1
Maider Marin
Maider Marin 2011년 7월 2일
I also compile the file in Matlab console like
mex -largeArrayDims blah.cxx
somehow the indexes definition need it, this is just for Matlab 2010a.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Chirag Gupta
Chirag Gupta 2011년 7월 2일
Also google, there are solutions to this

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by