我已经安装了Visual Studio 2010。但是,MATLAB找不到编译器。
>> mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[0] None
Compiler:如果我对这个问题回答n,我会得到以下结果
Would you like mex to locate installed compilers [y]/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] Microsoft Visual C++ 2005 SP1
[7] Microsoft Visual C++ 2008 Express
[8] Microsoft Visual C++ 2008 SP1
[0] None
Compiler: 8
The default location for Microsoft Visual C++ 2008 SP1 compilers is C:\Program Files (x86)\Microsoft Visual Studio 9.0,
but that directory does not exist on this machine.
Use C:\Program Files (x86)\Microsoft Visual Studio 9.0 anyway [y]/n? n
Please enter the location of your compiler: [C:\Program Files (x86)\Microsoft Visual Studio 9.0] 编译c++代码使其在MATLAB中可用的最简单方法是什么?安装Visual C++ 2008?oO
发布于 2010-11-03 02:47:13
这取决于您使用的MATLAB版本。R2010b开箱即可支持VS2010。如果您使用的是R2010a,可以使用以下补丁:
发布于 2010-11-02 21:34:08
有超过1种解决问题的方法,但只有一种涉及金钱:)
mbuild -setup.供将来参考:http://www.mathworks.com/support/compilers/R2010b/index.html
发布于 2010-11-03 01:36:14
您还可以在不使用mex的情况下使c++代码可用于Matlab。Matlab能够加载外部DLL并调用它们的函数。因此,您可以将代码包装到DLL中,并完全绕过mex。
一般来说,我发现这是从matlab中调用C或C++代码的一种更简单的方法。缺点是您不会拥有mex提供的用于操作matlab数据结构的所有工具。你仍然可以来回传递数据,有些事情会更麻烦,比如在C中分配一个数组,然后把它的所有权交给matlab。
https://stackoverflow.com/questions/4078094
复制相似问题