偶整理了一些有关于Matlab调用C/C++的资料,如果再有问题的请到这里查阅:
1、matlab c++ mathlib库在vc6下编译问题
发信人: hujin962 (星期爸), 信区: MathTools
标 题: Re: matlab c++ mathlib库在vc6下编译问题
发信站: BBS 水木清华站 (Mon Oct 14 08:35:28 2002), 站内信件
操作系统:win2000 prefessional
compiler: Microsoft VC 6.0
数学函数库:MatlabR12中 MATLAB C++ Math Library Version 2.1
1. Start up the Microsoft Visual C/C++ 6.0 IDE
2. Go to FILE and NEW. Click on Projects Tab.
Select Win32 Console Application.
In the Project Name field type: ex1.
"Create new workspace" should be filled in.
In the Platforms field, "Win32" should also be checked.
Click OK.
3. Highlight ex1 files and then right click.
Select Settings. Click on the C/C++ Tab.
In the Category listbox select "Code Generation".
In the "Use Runtime library" listbox select
"Multithreaded DLL".
Change the Category listbox to "reprocessor".
添加_WINDOWS, _AFXDLL,IBMPC, MSVC, MSWIND, __STDC__
变为:
WIN32,_DEBUG,_CONSOLE,_MBCS,_WINDOWS,_AFXDLL,
IBMPC,MSVC,MSWIND,__STDC__
Tools->Options->Directories
Include files添加:
c:\matlabr12\extern\include
c:\matlabr12\extern\include\cpp
Library files添加:
C:\MATLABR12\extern\lib\win32\microsoft\msvc60
C:\MATLABR12\extern\lib\win32
NOTE: 这些路径设置最好还是根据自己的PC环境检查一下,很简单
Click on the "Link" Tab. In the Category listbox select "Input".
For C applications, the Object/Library modules
本来是:
kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
在左侧添加:
libmmfile.lib libmatlb.lib libmx.lib libmat.lib sgl.lib
libmwsglm.lib
NOTE: 这些lib都不用自己生成,
它在C:\MATLABR12\extern\lib\win32\microsoft\msvc60目录
和C:\matlabr12\extern\lib\win目录下
NOTE: libmcc.lib对于matlabR12和更高的版本就不需要了,
同样mcc.h也是matlab5.3留下的,不再需要在工程中包含
NOTE: If you are creating C++ executables you will need to
add libmatpm.lib在最左边
它在C:\MATLABR12\extern\lib\win32目录下
Click OK.
4. Go to Build and Rebuild All.
5. Go to Build and Execute ex1.exe.
|