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)
uj5u.com熱心網友回復:
呼叫的程式如下: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(); //結束
uj5u.com熱心網友回復:
不要做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
共享臨時文本檔案這種行程之間的通訊方法相比其它方法的優點有很多,下面僅列出我現在能想到的:
·行程之間松耦合
·行程可在同一臺機器上,也可跨機,跨作業系統,跨硬體平臺,甚至跨國。
·方便除錯和監視,只需讓第三方或人工查看該臨時文本檔案即可。
·方便在線開關服務,只需洗掉或創建該臨時文本檔案即可。
·方便實作分布式和負載均衡。
·方便佇列化提供服務,而且幾乎不可能發生佇列滿的情況(除非硬碟空間滿)
·……
“跨語言、跨機,跨作業系統,跨硬體平臺,跨國,跨*.*的”苦海無邊,
回頭是“使用共享純文本檔案進行資訊交流”的岸!
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/139811.html
標籤:基礎類
上一篇:做一個畫圖軟體
