Giter Club home page Giter Club logo

Comments (2)

kyamagu avatar kyamagu commented on July 18, 2024

It seems a VS2010 issue. Is your visual studio up-to-date (patches, service pack, etc.)?

http://connect.microsoft.com/VisualStudio/feedback/details/498952/vs2010-iostream-is-incompatible-with-matlab-matrix-h

from mexopencv.

amroamroamro avatar amroamroamro commented on July 18, 2024

The same issue was reported before (#16), but the ticket somehow disappeared.. (maybe original user deleted their account?)

Anyway, I recovered the discussion using Google cache, which I quote below for the record.

Please try the suggested solutions and report if the problem is fixed


Problem with visual studio 2010

newbie19 opened this issue September 08, 2012

I tried mexopencv using Matlab 2010a, opencv 2.4.2, and visual studio 2010, then I got following problem:

MxArray.cpp
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'

By googling I learned that this problem occurs since I used visual studio 2010. There are many suggested solutions here:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/281754
but I don't know how to implement it for mexopencv.

The first error happened in MxArray.cpp , but I cannot find any line that called matrix.h.

So, can somebody help me here?

amroamroamro commented September 08, 2012

What do you get when you try to compile a minimalistic MEX function?

#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    mexPrintf("test\n");
}

Save the above in a C++ file textMEX.cpp, and compile it using mex testMEX.cpp

In case of problems, the following section found towards the end of tmwtypes.h could be the cause of your issues:

$MATLABROOT\extern\include\tmwtypes.h

/** UTF-16 character type */

#if defined(__STDC_UTF_16__) || (defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT)
typedef char16_t CHAR16_T;
#elif defined(_MSC_VER)
typedef wchar_t CHAR16_T;
#else
typedef UINT16_T CHAR16_T;
#endif

This file is included by "matrix.h" which is in turn included by "mex.h" (required by all MEX files)

(I am using R2012a on WinXP+VS2010 and I have no problems compiling)

kyamagu commented September 08, 2012

Do you install Windows SDK? You say you're using vs2010 win64 but at least your compiler seems to be x86. Make sure you're using 64-bit compiler in Matlab 64-bit and also run mex -setup to choose Win SDK for the compiler.

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'

amroamroamro commented September 08, 2012

Also VS2010 was only officially supported starting at MATLAB R2010b, although there is a patch available for R2010a. Perhaps you should consider updating MATLAB if possible..

As a quick fix, try editing MxArray.hpp, and move mex.h after the other includes with:

#ifdef _CHAR16T
#define CHAR16_T
#endif
#include "mex.h"

Some more references found here and here.

kyamagu closed the issue November 07, 2012

from mexopencv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.