声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3208|回复: 29

[混合编程] matlab7.0和C++的接口问题

[复制链接]
发表于 2007-4-28 12:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
我要用matlab7.0做毕业设计,在刚装上的时候要建立两个C的接口文件,分别为afdtdpbg.c和fdtdpbg.c,执行步骤为先把它们贴到MATLAB的WORK目录下面,然后打开MATLAB,输入mex afdtdpbg.c回车,选数字2;再输入mex fdtdpbg.c,回车,理论上是应该出现两个.DLL文件,即借口文件,可是却出现下面的报错,
To get started, select MATLAB Help or Demos from the Help menu.

>> mex afdtdpbg.c

  D:\1\BIN\WIN32\MEX.PL: Error: Compile of 'afdtdpbg.c' failed.

??? Error using ==> mex
Unable to complete successfully

>>  



请问这是怎么回事呢,拜托大家帮个忙
回复
分享到:

使用道具 举报

发表于 2007-4-28 12:45 | 显示全部楼层
原帖由 dongjun1101 于 2007-4-28 12:14 发表
我要用matlab7.0做毕业设计,在刚装上的时候要建立两个C的接口文件,分别为afdtdpbg.c和fdtdpbg.c,执行步骤为先把它们贴到MATLAB的WORK目录下面,然后打开MATLAB,输入mex afdtdpbg.c回车,选数字2;再输入mex fdtdpb ...

先 mbuild -setup,再 mex -setup

这类问题 google 一下就找到答案了,论坛也讨论过多次,下次建议自己先动手
 楼主| 发表于 2007-4-28 12:49 | 显示全部楼层
我第一次用这个,不太明白的,是卸了,再按你说的步骤装吗:@L
 楼主| 发表于 2007-4-28 12:50 | 显示全部楼层
mbuild -setup是什么意思?
发表于 2007-4-28 12:51 | 显示全部楼层
原帖由 dongjun1101 于 2007-4-28 12:49 发表
我第一次用这个,不太明白的,是卸了,再按你说的步骤装吗:@L


当然,不过前提是你电脑安装了VC,再在matlab设置
 楼主| 发表于 2007-4-28 12:57 | 显示全部楼层
那我把MATLAB卸了,C就不用在再
装了吧
 楼主| 发表于 2007-4-28 13:03 | 显示全部楼层
这样就可以生成.DLL的接口文件了吗?只在控制面板上卸载可以卸干净吗?
我都快成问题少女了,:@L
发表于 2007-4-28 13:13 | 显示全部楼层
原帖由 dongjun1101 于 2007-4-28 13:03 发表
这样就可以生成.DLL的接口文件了吗?只在控制面板上卸载可以卸干净吗?
我都快成问题少女了,:@L


可以卸载干净

matlab 删除重装后估计 C 应该不用重装
 楼主| 发表于 2007-4-28 13:18 | 显示全部楼层
好的,我试试看,:loveliness:

[ 本帖最后由 eight 于 2007-4-28 13:24 编辑 ]
 楼主| 发表于 2007-4-28 13:49 | 显示全部楼层
还是不行>> mex afdtdpbg.c

  D:\MATLAB7.0\BIN\WIN32\MEX.PL: Error: Compile of 'afdtdpbg.c' failed.

??? Error using ==> mex
Unable to complete successfully

>>
发表于 2007-4-28 13:51 | 显示全部楼层
原帖由 dongjun1101 于 2007-4-28 13:49 发表
还是不行>> mex afdtdpbg.c

  D:\MATLAB7.0\BIN\WIN32\MEX.PL: Error: Compile of 'afdtdpbg.c' failed.

??? Error using ==> mex
Unable to complete successfully

>>


把 mbuild 和 mex 两个setup的结果贴上来
 楼主| 发表于 2007-4-28 13:54 | 显示全部楼层
To get started, select MATLAB Help or Demos from the Help menu.

>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:

Would you like mbuild to locate installed compilers [y]/n? y

Select a compiler:
[1] Lcc C version 2.4 in D:\MATLAB7.0\sys\lcc
[2] Microsoft Visual C/C++ version 6.0 in E:

[0] None

Compiler: 2

Please verify your choices:

Compiler: Microsoft Visual C/C++ 6.0
Location: E:

Are these correct?([y]/n): y
Warning: Mbuild requires that the Microsoft Visual C++ 6.0
directories "VC98" and "Common" be located within the same parent directory.
(Expected to find a directory named "Common" in the directory 'E:'.)
Try to update options file: C:\Documents and Settings\xiaowei\Application Data\MathWorks\MATLAB\R14\compopts.bat
From template:              D:\MATLAB7.0\BIN\WIN32\mbuildopts\msvc60compp.bat

Done . . .


--> "D:\MATLAB7.0\bin\win32\mwregsvr D:\MATLAB7.0\bin\win32\mwcomutil.dll"

DllRegisterServer in D:\MATLAB7.0\bin\win32\mwcomutil.dll succeeded

--> "D:\MATLAB7.0\bin\win32\mwregsvr D:\MATLAB7.0\bin\win32\mwcommgr.dll"

DllRegisterServer in D:\MATLAB7.0\bin\win32\mwcommgr.dll succeeded

>> 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:\MATLAB7.0\sys\lcc
[2] Microsoft Visual C/C++ version 6.0 in E:

[0] None

Compiler: 3
Please select from 0-2
Compiler: 2

Please verify your choices:

Compiler: Microsoft Visual C/C++ 6.0
Location: E:

Are these correct?([y]/n): y
Warning: Mex requires that the Microsoft Visual C++ 6.0
directories "VC98" and "Common" be located within the same parent directory.
(Expected to find a directory named "Common" in the directory 'E:'.)
Try to update options file: C:\Documents and Settings\xiaowei\Application Data\MathWorks\MATLAB\R14\mexopts.bat
From template:              D:\MATLAB7.0\BIN\WIN32\mexopts\msvc60opts.bat

Done . . .

>> mex afdtdpbg.c

  D:\MATLAB7.0\BIN\WIN32\MEX.PL: Error: Compile of 'afdtdpbg.c' failed.

??? Error using ==> mex
Unable to complete successfully

>>
发表于 2007-4-28 13:59 | 显示全部楼层
Warning: Mbuild requires that the Microsoft Visual C++ 6.0
directories "VC98" and "Common" be located within the same parent directory.
(Expected to find a directory named "Common" in the directory 'E:'.)
Try to update options file: C:\Documents and Settings\xiaowei\Application Data\MathWorks\MATLAB\R14\compopts.bat
From template:              D:\MATLAB7.0\BIN\WIN32\mbuildopts\msvc60compp.bat


估计是上面的warning造成的,按照它的提示先手动修改一下吧
 楼主| 发表于 2007-4-28 14:04 | 显示全部楼层
呵呵,这个是什么意思啊?
发表于 2007-4-28 14:08 | 显示全部楼层
原帖由 dongjun1101 于 2007-4-28 14:04 发表
呵呵,这个是什么意思啊?


自己用金山词霸等工具翻译一下吧
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-23 23:24 , Processed in 0.099189 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表