怎样在VC++6.0中应用Matlab的C++数学库?(程序算法,独立应用程序)
大家知道算法设计比较繁复也比较枯燥,我想用Matlab解决程序中的计算问题。
据书上介绍:可以在VC++6.0中调用Matlab 的C++数学库来进行计算,生成的应用
程序可以独立于Matlab运行。
但我试过多次都未成功,
我的源码如下(工程类型为W32 Console Apllication):
#include <iostream.h>
#include "matlab.hpp"
#include <stalib.h>
#ifdef Gcc
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
#endif
int main(void)
{
static double data1[]={1,1,1,1};
static double data2[]={2,2,2,2};
mwArray A(2,2,data1);
mwArray B(2,2,data2);
mwArray C=mtimes(A,B);
cout<<"C="<<endl;
cout<<C<<endl;
return 1;
}
编译后出现如下错误:
g:\matlab53\extern\include\cpp\mathwork.h(25) : error C2371: 'bool' : redefinition; different basic types
f:\microsoft visual studio\myprojects\mat\sou.cpp(0) : see declaration of 'bool'
g:\matlab53\extern\include\cpp\matmtxif.h(19) : fatal error C1083: Cannot open include file: 'strstream.h': No such file or directory
不知是软件的问题(我用的是盗版软件),还是书上介绍的不对,又或者是我理解的不对。
恳请指教!!(介绍一些这方面的书亦可。)