C 初学者,用MFC做了个简单界面,只有一个按钮,点击后输出图形。源代码是matlab写的,安装了matcom进行转化。运行时候出现错误代码,,,请问问题出在哪里了??备注:按照百度上解决办法,查看了一些路径,貌似没错:
--------------------Configuration: Demo - Win32 Debug--------------------
Compiling...
DemoDlg.cpp
C:\WWKK\Demo\DemoDlg.cpp(175) : error C2065: 'initM' : undeclared identifier
C:\WWKK\Demo\DemoDlg.cpp(175) : error C2065: 'MATCOM_VERSION' : undeclared identifier
c:/matcom45/samples/demo1.m(1) : error C2065: 'dMm' : undeclared identifier
c:/matcom45/samples/demo1.m(1) : error C2065: 't1' : undeclared identifier
c:/matcom45/samples/demo1.m(1) : error C2065: 'y' : undeclared identifier
c:/matcom45/samples/demo1.m(1) : error C2065: 'call_stack_begin' : undeclared identifier
c:/matcom45/samples/demo1.m(1) : error C2065: '_' : undeclared identifier
c:/matcom45/samples/demo1.m(1) : error C2146: syntax error : missing ';' before identifier 't1'
c:/matcom45/samples/demo1.m(1) : error C2065: 'colon' : undeclared identifier
c:/matcom45/samples/demo1.m(2) : error C2146: syntax error : missing ';' before identifier 'y'
c:/matcom45/samples/demo1.m(2) : error C2065: 'sinc' : undeclared identifier
c:/matcom45/samples/demo1.m(3) : error C2146: syntax error : missing ';' before identifier 'plot'
c:/matcom45/samples/demo1.m(3) : error C2065: 'plot' : undeclared identifier
c:/matcom45/samples/demo1.m(3) : error C2065: 'CL' : undeclared identifier
c:/matcom45/samples/demo1.m(3) : error C2146: syntax error : missing ';' before identifier 'grid'
c:/matcom45/samples/demo1.m(3) : error C2065: 'grid' : undeclared identifier
c:/matcom45/samples/demo1.m(4) : error C2146: syntax error : missing ';' before identifier 'axis'
c:/matcom45/samples/demo1.m(4) : error C2065: 'axis' : undeclared identifier
c:/matcom45/samples/demo1.m(4) : error C2065: 'BR' : undeclared identifier
c:/matcom45/samples/demo1.m(5) : error C2146: syntax error : missing ';' before identifier 'title'
c:/matcom45/samples/demo1.m(5) : error C2065: 'title' : undeclared identifier
c:/matcom45/samples/demo1.m(5) : error C2065: 'TM' : undeclared identifier
c:/matcom45/samples/demo1.m(7) : error C2065: 'call_stack_end' : undeclared identifier
c:/matcom45/samples/demo1.m(8) : error C2065: 'exitM' : undeclared identifier
执行 cl.exe 时出错.Demo.exe - 1 error(s), 0 warning(s)

解决方案 »

  1.   

    调用的程序如下:
    initM(MATCOM_VERSION);   //初始化
    #line 1 "c:/matcom45/samples/demo1.m"
    //计算并绘制sinc函数波形
      dMm(t1); dMm(y);  
      #line 2 "c:/matcom45/samples/demo1.m"
      call_stack_begin;
      #line 2 "c:/matcom45/samples/demo1.m"
    _ t1 = colon(-5.0,0.01,5.0);
      #line 3 "c:/matcom45/samples/demo1.m"
    _ y = sinc(t1);
      #line 4 "c:/matcom45/samples/demo1.m"
    _ plot((CL(t1)));
      #line 5 "c:/matcom45/samples/demo1.m"
    _ axis((BR(-5.0),5.0,-0.5,1.5));
      #line 6 "c:/matcom45/samples/demo1.m"
    _ title((CL(TM("sinc函数"))));
    call_stack_end;
    exitM();   //结束
      

  2.   

    不要做A语言代码修改为B语言代码的无用功。
    也不要做用A语言代码直接调用B语言代码库这样复杂、这样容易出错的傻事。
    只需让A、B语言代码的输入输出重定向到文本文件,或修改A、B语言代码让其通过文本文件输入输出。
    即可很方便地让A、B两种语言之间协调工作。
    比如:
    A将请求数据写到文件a.txt,写完后改名为aa.txt
    B发现aa.txt存在时,读取其内容,调用相应功能,将结果写到文件b.txt,写完后删除aa.txt,改名为bb.txt
    A发现bb.txt存在时,读取其内容,读完后删除bb.txt
    以上A可以替换为任何一种开发语言或开发环境,B可以替换为任何一种与A不同的开发语言或开发环境。
    除非A或B不支持判断文件是否存在、文件读写和文件更名。
    但是谁又能举出不支持判断文件是否存在、文件读写和文件更名的开发语言或开发环境呢?
    可以将临时文件放在RamDisk上提高效率减少磨损磁盘。
    数据的结构很复杂的话,文本文件的格式问题可参考json或xml共享临时文本文件这种进程之间的通讯方法相比其它方法的优点有很多,下面仅列出我现在能想到的:
    ·进程之间松耦合
    ·进程可在同一台机器上,也可跨机,跨操作系统,跨硬件平台,甚至跨国。
    ·方便调试和监视,只需让第三方或人工查看该临时文本文件即可。
    ·方便在线开关服务,只需删除或创建该临时文本文件即可。
    ·方便实现分布式和负载均衡。
    ·方便队列化提供服务,而且几乎不可能发生队列满的情况(除非硬盘空间满)
    ·……“跨语言、跨机,跨操作系统,跨硬件平台,跨国,跨*.*的”苦海无边,
    回头是“使用共享纯文本文件进行信息交流”的岸!