找回密码
 注册
Simdroid-非首页
查看: 48|回复: 0

基于MFC与matlab混编时用宏DECLARE_FEVAL_TABLE注册函数出错

[复制链接]
发表于 2011-1-3 19:30:08 | 显示全部楼层 |阅读模式 来自 黑龙江哈尔滨
我写了一个基于MFC的对话框程序,这只是个例子,具体的复杂些,但问题是一样的,就是我要调用fmin函数,
他的一个参数是个函数,例子中func1,调用之前需要对其注册,我将func1作为对话框类的一个子函数,但使用
DECLARE_FEVAL_TABLE
FEVAL_ENTRY(func1)
END_FEVAL_TABLE
进行函数注册时,报错如下
error C2065: 'func1' : undeclared identifier
应给是说func1不能识别,但我在头文件已经定义了啊!
非常头痛!
具体代码如下
  1. MFCOdeDlg.h
  2. class CMFCOdeDlg : public CDialog
  3. {
  4. // Construction
  5. public:
  6. mwArray func1(mwArray x);
  7. CMFCOdeDlg(CWnd* pParent = NULL); // standard constructor

  8. // Dialog Data
  9. //{{AFX_DATA(CMFCOdeDlg)
  10. enum { IDD = IDD_MFCODE_DIALOG };
  11. // NOTE: the ClassWizard will add data members here
  12. //}}AFX_DATA

  13. // ClassWizard generated virtual function overrides
  14. //{{AFX_VIRTUAL(CMFCOdeDlg)
  15. protected:
  16. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  17. //}}AFX_VIRTUAL

  18. // Implementation
  19. protected:
  20. HICON m_hIcon;

  21. // Generated message map functions
  22. //{{AFX_MSG(CMFCOdeDlg)
  23. virtual BOOL OnInitDialog();
  24. afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  25. afx_msg void OnPaint();
  26. afx_msg HCURSOR OnQueryDragIcon();
  27. afx_msg void OnOut();
  28. //}}AFX_MSG
  29. DECLARE_MESSAGE_MAP()
  30. };

  31. MFCOdeDlg.cpp
  32. mwArray CMFCOdeDlg::func1(mwArray x)
  33. {
  34. return(times(realsqrt(x), reallog(x)));
  35. }
  36. DECLARE_FEVAL_TABLE
  37. FEVAL_ENTRY(func1)
  38. END_FEVAL_TABLE
复制代码

另:我如果将func1作为一个全局函数,是可以注册的,但是这样程序就乱了,希望大家帮助,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-10-5 03:22 , Processed in 0.034419 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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