| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1767 人关注过本帖
标题:[求助]vc调用matcom出错
只看楼主 加入收藏
beikechangyou
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-6-1
收藏
 问题点数:0 回复次数:3 
[求助]vc调用matcom出错

1、启动MIDEVA ,File-> New,新建如下Test1.m文件:

x=1:0.1:10; y=sin(x); plot(x,y);

保存文件并编译:m文件保存的默认位置为:matcom安装目录\matcom45,生成的C++文件保存的默认位置为:matcom安装目录\matcom45\Debug\,本例matcom安装目录为C盘 即 C:\matcom45\Debug\,在该目录下将会产生Test1.h、Test1.cpp、Test1.r 、Test1.obj文件。

2、在VC中用MFC Wizard(exe)创建一个基于对话框名为Example的工程。

在面板上添加一个ID为IDC_BUTTON1按扭。

3、将C:\matcom45\Debug目录下的Test1.cpp文件的内容拷贝到void CExamleDlg::OnButton1()下

void CVc_matcomDlg::OnButton1()
{
// TODO: Add your control notification handler code here

initM (MATCOM_VERSION);
dMm(x); dMm(y);

#line 1 "d:/matcom4.5/matcom45/test.m"
call_stack_begin;
#line 1 "d:/matcom4.5/matcom45/test.m"
_ x = colon(1.0,0.1,10.0);
#line 1 "d:/matcom4.5/matcom45/test.m"
_ y = sin(x);
#line 1 "d:/matcom4.5/matcom45/test.m"
_ plot((CL(x),y));

call_stack_end;

exitM();


}

4、将C:\matcom45\lib\下的matlib.h 和v4501v文件和C:\matcom45\debug下的Test1.h文件拷贝到工程Example目录下,然后在VC中将库文件和头文件加入到工程中:工程-> 添加工程-> Files,选择刚刚拷贝到Example目录下的matlib.h 、v4501v和Test1.h文件

5、在ExamleDlg.cpp中加入如下代码:

#include "matlib.h"#include "Test1.h"

6、在void CExamleDlg::OnButton1()中分别添加一个初始化类库调用函数”initM(MATCOM_VERSION)”和一个结束类库调用函数”exitM();

运行程序,出现如下错误:
C:\Documents and Settings\Administrator\My Documents\vc6.0\vc_matcom\vc_matcomDlg.cpp(177) : error C2065: 'initM' : undeclared identifier
C:\Documents and Settings\Administrator\My Documents\vc6.0\vc_matcom\vc_matcomDlg.cpp(177) : error C2065: 'MATCOM_VERSION' : undeclared identifier
C:\Documents and Settings\Administrator\My Documents\vc6.0\vc_matcom\vc_matcomDlg.cpp(178) : error C2065: 'dMm' : undeclared identifier
C:\Documents and Settings\Administrator\My Documents\vc6.0\vc_matcom\vc_matcomDlg.cpp(178) : error C2065: 'x' : undeclared identifier
C:\Documents and Settings\Administrator\My Documents\vc6.0\vc_matcom\vc_matcomDlg.cpp(178) : error C2065: 'y' : undeclared identifier
d:/matcom4.5/matcom45/test.m(1) : error C2065: 'call_stack_begin' : undeclared identifier
d:/matcom4.5/matcom45/test.m(1) : error C2065: '_' : undeclared identifier
d:/matcom4.5/matcom45/test.m(1) : error C2146: syntax error : missing ';' before identifier 'x'
d:/matcom4.5/matcom45/test.m(1) : error C2065: 'colon' : undeclared identifier
d:/matcom4.5/matcom45/test.m(1) : error C2146: syntax error : missing ';' before identifier 'y'
d:/matcom4.5/matcom45/test.m(1) : error C2065: 'sin' : undeclared identifier
d:/matcom4.5/matcom45/test.m(1) : error C2146: syntax error : missing ';' before identifier 'plot'
d:/matcom4.5/matcom45/test.m(1) : error C2065: 'plot' : undeclared identifier
d:/matcom4.5/matcom45/test.m(1) : error C2065: 'CL' : undeclared identifier
d:/matcom4.5/matcom45/test.m(3) : error C2065: 'call_stack_end' : undeclared identifier
d:/matcom4.5/matcom45/test.m(5) : error C2065: 'exitM' : undeclared identifier
Error executing cl.exe.

vc_matcomDlg.obj - 16 error(s), 0 warning(s)

谁能帮我看一下呀。谢谢了。

搜索更多相关主题的帖子: matcom 
2006-06-01 15:38
fg32152128
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-5-19
收藏
得分:0 
什么东东啊????
你的问题没头没尾的
2006-06-02 09:53
xinghot
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-6-3
收藏
得分:0 
将几个头文件#include到ExamleDlg.h中试试,好了请客啊呵呵
2006-06-03 10:50
renee524
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-6-14
收藏
得分:0 
回复 3楼 xinghot
这个方法真的好用耶
2013-06-14 09:39
快速回复:[求助]vc调用matcom出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011430 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved