Matlab 版 (精华区)

发信人: zjliu (秋天的萝卜), 信区: Matlab
标  题: [合集]新问题vc和matlab,请指教!!!急
发信站: 哈工大紫丁香 (2003年10月13日21:09:20 星期一), 站内信件


────────────────────────────────────────
 dairyfeel (别有用心)                 于 Sat Oct 11 15:43:38 2003 说道:

用vc调用matlab引擎,问题出在哪里,请用过的人指教,在此谢了,
下面是在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: 
[1] Lcc C version 2.4 in D:\MATLAB6P5\sys\lcc 
[2] Microsoft Visual C/C++ version 6.0 in D:\Program Files\Microsoft Visual St
udio 
 
[0] None 
 
Compiler: 2
 
Please verify your choices: 
 
Compiler: Microsoft Visual C/C++ 6.0 
Location: D:\Program Files\Microsoft Visual Studio 
 
Are these correct?([y]/n): y
 
The default options file: 
"C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R13
\mexopts.bat" 
is being updated from D:\MATLAB6P5\BIN\WIN32\mexopts\msvc60opts.bat... 
 
Installing the MATLAB Visual Studio add-in ... 
 
  Updated D:\Program Files\Microsoft Visual Studio\common\msdev98\template\MAT
LABWizard.awx 
    from D:\MATLAB6P5\BIN\WIN32\MATLABWizard.awx 
  Updated D:\Program Files\Microsoft Visual Studio\common\msdev98\template\MAT
LABWizard.hlp 
    from D:\MATLAB6P5\BIN\WIN32\MATLABWizard.hlp 
  Updated D:\Program Files\Microsoft Visual Studio\common\msdev98\addins\MATLA
BAddin.dll 
    from D:\MATLAB6P5\BIN\WIN32\MATLABAddin.dll 
  Merged D:\MATLAB6P5\BIN\WIN32\usertype.dat 
    with D:\Program Files\Microsoft Visual Studio\common\msdev98\bin\usertype.
dat 
 
>> mex -f D:\matlab6p5\bin\win32\mexopts\msvc60engmatopts.bat D:\matlab6p5\ext
ern\examples\eng_mat\engwindemo.c
  Could not find the compiler "cl" on the DOS path. 
  Use mex -setup to configure your environment properly. 
 
 
  D:\MATLAB6P5\BIN\WIN32\MEX.PL: Error: Unable to locate compiler. 
 
??? Error using ==> mex
Unable to complete successfully


────────────────────────────────────────
 startend (我是一头猪,大家别理我!)  于 2003年10月11日16:36:59 星期六 说道:

估计很难成功,我mex –setup;和mbuild –setup;
都运行了
工具栏都出来了,可是不能新建MATLAB project,一建完finish就非法操作

────────────────────────────────────────
 zhangyanxin (river)                  于 2003年10月11日16:40:52 星期六 说道:

把倒数第二串去掉

────────────────────────────────────────
 zhangyanxin (river)                  于 2003年10月11日16:44:40 星期六 说道:

其实不必使用mex命令,在VC中包含几个库文件,使用VC的编译器就可以了
其中包括libeng.lib, and libmx.lib

────────────────────────────────────────
 dairyfeel (别有用心)                 于 Sat Oct 11 17:33:40 2003 说道:

像兄才说的那样也可以,可是我还有问题,我把生成的libeng.lib libmx.lib libmat.li
b包括进去之后,又出现了问题,我项目中加入engwindemo.c之后,连接又出现了如下问题

Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/matlabfirst.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

matlabfirst.exe - 2 error(s), 0 warning(s)

为什么???????????


────────────────────────────────────────
 startend (我是一头猪,大家别理我!)  于 2003年10月11日19:12:18 星期六 说道:

如果你下载的是那个例子的话
engwindemo和其他的testusematlab不是一起的
engwindemo是一个单独的程序
其他的合起来是一个工程

────────────────────────────────────────
 dairyfeel (别有用心)                 于 Sat Oct 11 19:29:44 2003 说道:

我不是下载的程序,是用matlab自带的程序


────────────────────────────────────────
 zhangyanxin (river)                  于 2003年10月11日19:34:35 星期六 说道:

这位兄台,你用VC先建立一个console类型的空工程,然后把engwindemo.c文件家如工程,
编译连接就一切OK了,注意一定是console类型妖
【 在 dairyfeel (别有用心) 的大作中
提到: 】

────────────────────────────────────────
 startend (我是一头猪,大家别理我!)  于 2003年10月11日20:15:48 星期六 说道:

双击engwindemo.c,就打开MSDEV,点击编译,会问你要不要一个workspace?
点yes
然后加上libeng.lib、libmx.lib就可以编译搞定了

────────────────────────────────────────
 dairyfeel (别有用心)                 于 Sun Oct 12 08:50:47 2003 说道:

我就是根据这种方法做的,才出现了两个错误,是链接的错误

为什么

────────────────────────────────────────
 zhangyanxin (river)                  于 2003年10月12日19:49:42 星期天 说道:

上个帖子有个失误,console类型的程序应当对应engdemo.c程序,至于engwindemo.c程序
,请兄台创建win32 application就可以了。
【 在 dairyfeel (别有用心) 的大作中提到:
 】: 我就是根据这种方法做的,才出现了两个错误,是链接的错误

────────────────────────────────────────
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.887毫秒