Matlab 点滴

来源:互联网 发布:现在淘宝开店步骤 编辑:程序博客网 时间:2024/05/22 17:30

1. Conflicts when MEX cpp file (Matlab 2009a + VS2010)

测试 pose_estimation_code_release_v1.21, installmex时, 报错:

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\r2009a\extern\include\matrix.h(329) : see declaration of 'char16_t'

原因是char16_t 在yvals.h中定义为 unsigned short 而在 matrix.h被重定义为 wchar_t (通过CHAR16_T)。

Compiling MCR C++ dll with VS2010 中有一些建议的解决方法,比如namespace,修改源文件等。

yvals.h和matrix.h都是系统文件,要修改需要管理员权限,而且还不知道改后会不会影响其他使用。

最后在下面两个文件的开头(其实也就是matric.h之前)加上:


#include <yvals.h>
#if (_MSC_VER >= 1600)
#define __STDC_UTF_16__
#endif

,这样就不会重定义 char16_t。

UTILS\mexDGC.cpp

UTILS\nema_lognorm_fast.cxx



0 0
原创粉丝点击