日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

matlab vs2010编译器xml,如何在MATLAB R2010a 中使用Visual C++ 2010编译器

發布時間:2024/9/27 c/c++ 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab vs2010编译器xml,如何在MATLAB R2010a 中使用Visual C++ 2010编译器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、安裝補丁VS2010MEXSupport.zip

參考http://www.mathworks.cn/support/solutions/en/data/1-D5W493/index.html?solution=1-D5W493

由于MATLAB R2010a 發布的時間要比

VS2010早,所以在該版本識別不了VC++2010編譯器。不過R2010a之后的版本應該不會有這種問題了。

解壓補丁包,將其中的文件放到 D:\Program

Files\MATLAB\R2010a\bin\win32\mexopts 文件夾下。

2、在MATLAB中安裝VC++ 2010 編譯器

打開Matlab,在 command window

中輸入 mex -setup

————————————————————————————————————————————-

>> mex -setup

Please choose your compiler for building external interface (MEX)

files:

Would you like mex to locate installed compilers [y]/n?

n ?(一定要選擇 n)

Select a compiler:

[1] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1

linker)

[2] Intel C++ 9.1 (with Microsoft Visual C++ 2005 SP1 linker)

[3] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1

linker)

[4] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell

linker)

[5] Intel Visual Fortran 10.1 (with Microsoft Visual C++ 2005 SP1

linker)

[6] Lcc-win32 C 2.4.1

[7] Microsoft Visual C++ 6.0

[8] Microsoft Visual C++ 2005 SP1

[9] Microsoft Visual C++ 2008 Express

[10] Microsoft Visual C++ 2008 SP1

[11] Microsoft Visual C++ 2010

[12] Microsoft Visual C++ 2010 Express

[13] Open WATCOM C++

[0] None

Compiler:12

————————————————————————————————————————————————

注意,如果選擇 n 之后,沒有列出這么多編譯器選項,甚至沒有出現VC++ 2010。

不要慌,此時選擇 0,即None。

—————————————————————————————————————————————————

Compiler: 0

mex: No compiler selected. No action taken.

**************************************************************************

Warning: The MATLAB C and Fortran API has changed to support

MATLAB

variables with more than 2^32-1 elements. In the near future

you will be required to update your code to utilize the new

API. You can find more information about this at:

http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9

Building with the -largeArrayDims option enables the new API.

**************************************************************************

—————————————————————————————————————————————————

然后在command window 里再次輸入 mex -setup

—————————————————————————————————————————————————

>> mex -setup

Please choose your compiler for building external interface (MEX)

files:

Would you like mex to locate installed compilers [y]/n?

n ?(一定要選擇

n)

—————————————————————————————————————————————————

此時就會列出很多編譯器,包括已經VC++2010。如果還沒有,可重復幾次以上過程。當然前提是必須安裝VS2010,否則,再怎么重復,也找不到VC++2010編譯器。

列出VC++2010編譯器之后,我相信接下該怎么做對大家來說沒啥問題。

3、error C2371: 'char16_t' : redefinition; different

basic types

在混合編程中,也許會出現如下錯誤:

—————————————————————————————————————————————————

C:\Microsoft Visual Studio 10.0\VC\INCLUDE\yvals.h(576) : error

C2371: 'char16_t' : redefinition; different basic types

C:\Matlab\r2010a\extern\include\matrix.h(330) : see declaration of

'char16_t'

—————————————————————————————————————————————————

原因是VS2010中的yvals.h添加了char16_t的定義,而Matlab的matrix.h也包含對char16_t的定義,所以同時包含這兩個頭文件的話,會導致重復定義char16_t的錯誤。

解決方案:

參考:http://maciejgryka.com/bits/2011/09/char16_t-conflict-while-mexing-with-vs2010/

完全沒有必要修改這兩個頭文件(以防修改之后,會在將來導致一些問題),只需要在包含matrix.h之前包含yvals.h即可。例如:

#include

#if (_MSC_VER >= 1600)

#define __STDC_UTF_16__

#endif

#include "mex.h"

注:mex.h 包含matrix.h。這就要求我們必須知道所包含的頭文件是否包含matrix.h。

總結

以上是生活随笔為你收集整理的matlab vs2010编译器xml,如何在MATLAB R2010a 中使用Visual C++ 2010编译器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。