leftfullba 发表于 2006-5-12 14:47

MATLAB调用C++算法的疑问

<P>在MATLAB下调用C++编写的程序,系统有如下的警告:<BR>&gt;&gt; mex testm.cpp<BR>testm.cpp <BR>D:\Microsoft Visual Studio\VC98\INCLUDE\istream(547) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify -GX <BR>D:\Microsoft Visual Studio\VC98\INCLUDE\complex(203) : warning C4275: non dll-interface class 'std::_Complex_base&lt;float&gt;' used as base for dll-interface class 'std::complex&lt;float&gt;' <BR>      D:\Microsoft Visual Studio\VC98\INCLUDE\complex(203) : see declaration of 'complex&lt;float&gt;' <BR>D:\Microsoft Visual Studio\VC98\INCLUDE\complex(216) : warning C4275: non dll-interface class 'std::_Complex_base&lt;double&gt;' used as base for dll-interface class 'std::complex&lt;double&gt;' <BR>      D:\Microsoft Visual Studio\VC98\INCLUDE\complex(216) : see declaration of 'complex&lt;double&gt;' <BR>D:\Microsoft Visual Studio\VC98\INCLUDE\complex(229) : warning C4275: non dll-interface class 'std::_Complex_base&lt;long double&gt;' used as base for dll-interface class 'std::complex&lt;long double&gt;' <BR>      D:\Microsoft Visual Studio\VC98\INCLUDE\complex(229) : see declaration of 'complex&lt;long double&gt;' </P>
<P><BR>不知道这样的警告是不是就不可以调用该算法,请问有和改进方法???<BR>程序编译可以生成.DLL文件,但是调用的结果不正确.<BR>谢谢</P>

flight 发表于 2006-5-13 11:54

<P>我只用mex编译过c.你先找一下matlab有没有自带的c++程序,编译一下看是否正确。</P>

happy 发表于 2006-5-13 16:00

回复:(leftfullba)MATLAB调用C++算法的疑问

<DIV class=tc>这是因为使用了C++异常。/EHsc或/GX,两者是等价的。<BR><BR>exception. It is equivalent to /EHsc.<BR><BR>/GX is in effect, by default, when you compile from within the development environment. By default, /GX- is enabled when using command-line tools.<BR><BR>For more information, see C++ Exception Handling.<BR><BR>To set this compiler option in the Visual Studio development environment <BR><BR>Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties. <BR>Click the C/C++ folder. <BR>Click the Command Line property page. <BR>Type the compiler option in the Additional Options box. </DIV>
页: [1]
查看完整版本: MATLAB调用C++算法的疑问