刚开始学习用VC++调用matlab生成的DLL,找了网上一些资料,难以找到vs2008与MATLAB2009b版本的,按照以往版本做的总是有很多错误。经过两天努力,终于调试成功,这里将经验总结一下,以供有需要的人们参考。
实验环境:
Win7
MATLAB 2009b(安装路径:E:/Program Files/MATLAB/R2009a)
VS2008 中文版(安装路径:E:/Program Files/Microsoft Visual Studio 9.0)
1.Matlab 生成DLL
1.1编译器的安装
在matlab中先安装编译器,我在第一次安装的时候一路y下来,只有一个compiler,还是最老的。这教育我们要学会说N,按照以下步骤操作
>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers [y]/n? n
Select a compiler:
[1] Lcc-win32 C 2.4.1
[2] Microsoft Visual C++ 6.0
[3] Microsoft Visual C++ .NET 2003
[4] Microsoft Visual C++ 2005 SP1