使用控件时提示"未声明标识符"的解决方法

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u013037007/article/details/52987452

 enum { IDD = IDD_DIALOG1 };

error C2065: “IDC_RATIOHIGH”: 未声明的标识符(其他控件是相同错误,在此省略)

#include "resource.h"忘记添加

展开阅读全文

提示error C2065: “i”: 未声明标识符

02-15

/* intHist = computeIntegralHistogramMex(quantMatrix,height,width,prodQuant); computes the integral image of an image with */rnrnrn#include rn#include "mex.h"rnrnvoid mexFunction( int nlhs, mxArray *plhs[],rn int nrhs, const mxArray *prhs[] )rn rnrn int i,j,k,x1;rn double *quantMatrix, *intHist;rn int height,width,prodQuant;rn rn /* Check for proper number of arguments */rn rn if (nrhs != 4) rn mexErrMsgTxt("4 input argument required.");rn rn else if (nlhs > 1) rn mexErrMsgTxt("Too many output arguments.");rn rnrn if ( !mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) ||rn mxGetNumberOfDimensions(prhs[1]) != 2 )rn mexErrMsgTxt("input 1 (quantMatrix) must be a real double matrix");rn rn quantMatrix = mxGetPr(prhs[0]);rn height = mxGetScalar(prhs[1]);rn width = mxGetScalar(prhs[2]);rn prodQuant = mxGetScalar(prhs[3]);rn rn /* Create a matrix for the return argument */rn rn plhs[0] = mxCreateDoubleMatrix(prodQuant,(height+1)*(width+1),mxREAL);/* size of intHist*/rn rn intHist = mxGetPr(plhs[0]);rnrn rn rn for(i = 1;i <= height;i++)rn for(j = 1;j <= width;j++)rn rn x1 = floor(quantMatrix[(j-1)*height+(i-1)]);rn rn intHist[prodQuant*(j*(height+1)+i)+x1-1]=1; /* corresponding bin has value=1 at location (i,j) */rnrn for(k = 0;k < prodQuant;k++) rn intHist[prodQuant*(j*(height+1)+i)+k] += intHist[prodQuant*(j*(height+1)+i-1)+k] + intHist[prodQuant*((j-1)*(height+1)+i)+k] - intHist[prodQuant*((j-1)*(height+1)+i-1)+k];rn rn rn return; rnrn用Vs2010 提示error C2065: “i”: 未声明的标识符rn还有j,k,x1都是rn不知道是怎么回事呢 论坛

这里的一直提示 未声明标识符 mfc初学者

07-25

程序是mfc编程实现了lr分析器,rn头文件包含如下rn#include "stdafx.h"rn#include "LR.h" rn#include "LRDlg.h"rn#include "afxdialogex.h"rn#include"status_stack.h" //状态栈rn#include"symbol_instr_stack.h" // 符号输入串栈rn#include"llrr.h" 这是lr分析表的一个头文件rnrnBOOL WINAPI Main_Proc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)rnrn switch(uMsg)rn rn //HANDLE_MSG(hWnd,WM_INITDIALOG,Main_OnInitDialog);这里我给注释掉了rn HANDLE_MSG(hWnd,WM_COMMAND,Main_OnCommand);rn HANDLE_MSG(hWnd,WM_CLOSE,Main_OnClose);rn rn return false;rnrnrn之后的Main_OnCommand函数rnvoid Main_OnCommand(HWND hwnd,int id,HWND hwndCtl,UINT codeNotify)rn rn switch(id)rn rn case IDC_BUTTON1:rn rn //初始化各栈rn init_stack(hwnd,status_p);rn init_stack(hwnd,symbol_p);rn init_stack(hwnd,instr_p);rnrn //压进栈初始元素rn push(hwnd,status_p,0);rn push(hwnd,symbol_p,'#');rnrn char x;rn TCHAR msg[256];rn GetDlgItemText(hwnd,IDC_EDIT3,msg,sizeof(msg));rn unsigned int i;rn for(i=0;itop!=0)rn rn x=pop(hwnd,symbol_p);rn push(hwnd,instr_p,x);rn rnrn print(hwnd,status_p,symbol_p,instr_p);rn rn break;rn case IDC_BUTTON2:rn rn action(hwnd,status_p,symbol_p,instr_p);rn rn break;rn case IDC_BUTTON3:rn rn SetDlgItemText(hwnd,IDC_EDIT1,TEXT(""));rn SetDlgItemText(hwnd,IDC_EDIT2,TEXT(""));rn SetDlgItemText(hwnd,IDC_EDIT3,TEXT(""));rn SetDlgItemText(hwnd,IDC_EDIT4,TEXT(""));rn rn break;rn default:rn break;rn rn rnrn之后的Main_OnClose函数rn void Main_OnClose(HWND hwnd)rn rn EndDialog(hwnd,0);rn rnrn程序编译一直提示rn1>c:\users\zj\documents\visual studio 2012\projects\lr\lr\lrdlg.cpp(168): error C2065: “Main_OnCommand”: 未声明的标识符rn1>c:\users\zj\documents\visual studio 2012\projects\lr\lr\lrdlg.cpp(169): error C2065: “Main_OnClose”: 未声明的标识符rnrn网上百度说是头文件顺序问题 可是改了还是提示这样的错误。rn请问谁知道怎么修改这样才可以吗rnmfc初学 求指导 谢谢 论坛

没有更多推荐了,返回首页