473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

undeclared identifier error

270 100+
hi,
i'm new to mfc vc++ programming,
when i write following code i get error
Expand|Select|Wrap|Line Numbers
  1. Error    1    error C2065: 'IDE_ACCELERATOR1' : undeclared identifier    c:\documents and settings\nitin.mycomputer\desktop\mfc keyboard keys\mfc keyboard keys\mfc keyboard keys.cpp    10    
pls help me

here is the whole code:

Expand|Select|Wrap|Line Numbers
  1. #include "stdafx.h"
  2. #include<afxwin.h>
  3. #include "Resource.h"
  4.  
  5. class myframe:public CFrameWnd
  6. {
  7. public:
  8.     myframe()
  9.     {
  10.         LoadAccelTable(MAKEINTRESOURCE(IDE_ACCELERATOR1));
  11.         Create(0,TEXT("Accelerator"),WS_OVERLAPPEDWINDOW,rectDefault,0,MAKEINTRESOURCE(IDR_MENU1));
  12.     }
  13.     void fun1()
  14.     {
  15.         MessageBox(TEXT("Reached here to draw a line"),TEXT("Title"));
  16.     }
  17.     void fun2()
  18.     {
  19.         MessageBox(TEXT("Reached here to draw a Rectangle"),TEXT("Title"));
  20.     }
  21.     void fun3()
  22.     {
  23.         MessageBox(TEXT("Reached here to draw a Circle"),TEXT("Title"));
  24.     }
  25.     void fun4()
  26.     {
  27.         MessageBox(TEXT("Reached here to draw a Triangle"),TEXT("Title"));
  28.     }
  29.     DECLARE_MESSAGE_MAP()
  30. };
  31. BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
  32.     ON_COMMAND(101,fun1)
  33.     ON_COMMAND(102,fun2)
  34.     ON_COMMAND(103,fun3)
  35.     ON_COMMAND(104,fun4)
  36. END_MESSAGE_MAP()
  37. class myapp:public CWinApp
  38. {
  39. public:
  40.     int InitInstance()
  41.     {
  42.         myframe *p;
  43.         p=new myframe;
  44.         p->ShowWindow(3);
  45.         m_pMainWnd=p;
  46.         return 1; 
  47.     }
  48. };
  49. myapp a;
  50.  
Jul 30 '08 #1
4 4801
Banfa
9,065 Expert Mod 8TB
i get error
Error 1 error C2065: 'IDE_ACCELERATOR1' : undeclared identifier c:\documents and settings\nitin.mycomputer\desktop\mfc keyboard keys\mfc keyboard keys\mfc keyboard keys.cpp 10
That is because IDE_ACCELERATOR1 has not been declared anyway, see the error tells you what the problem is.

The problem is not in the code you posted but rather in another file, if IDE_ACCELERATOR1 is supposed to be a resource definition it should be defined in Resource.h, however you need to open you your resources in your IDE and see how you have defined your accelerator table.


As an aside MFC is an ancient technology and wasn't a very good one to start with. If you are looking to write Windows programs and have only just started out you would be better advised to use the .NET Framework.

You can download Visual Studio 2005 Express for free (or Visual Studio 2008 Express Beta) this will allow you to do .NET development.
Jul 30 '08 #2
NitinSawant
270 100+
any idea??
how to remove that error??
Aug 2 '08 #3
JosAH
11,448 Expert 8TB
any idea??
how to remove that error??
Didn't you read what Banfa wrote:

That is because IDE_ACCELERATOR1 has not been declared anyway, see the error tells you what the problem is.
So if something isn't declared and your compiler whines about it, you should
declare it somehow; it's up to you, it's your code.

kind regards,

Jos
Aug 2 '08 #4
NitinSawant
270 100+
gr8!!

problem solved!

I defined the variable in Resource.h
Aug 2 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Saurabh Aggrawal | last post by:
Hi, if (iter->m_name.compare(pstrName) == 0) { // Provide our object. *ppunkItem = iter->m_pUnknown; // Addref our object... iter->m_pUnknown->AddRef(); break; }
5
by: Marc Gustafson | last post by:
This function is executed when a application file is double-clicked to open in a VC++ application. Specifically, this function is enabled by RegisterShellFileTypes () in the application's...
0
by: Stephanie Doherty | last post by:
Hello World, I am trying to use a _spawnl function like this (and I have included the process.h file): _spawnl(_P_WAIT,iporgfile,iporgfile,NULL); It compiles with the following errors: ...
6
by: Peter Rothenbuecher | last post by:
Hello, when I try to compile the following code with g++ -o client client.c #include<sys/socket.h> #include<stdio.h> #include<stdlib.h> #define ADDRESS "mysocket"; #define MAXLEN 200;
10
by: teddarr | last post by:
I am trying to construct a class with several functions and identifiers. The identifier in question is static double AIR which will hold the value of the annual interest rate in the class. I have...
2
by: aarthi28 | last post by:
Hi, I have this code that I am trying to compile, but I am getting the following errors 'CoInitializeSecurity': identifier not found 'EOAC_NONE' : undeclared identifier I have pasted the...
5
by: vmagana | last post by:
First of all I would like to indicate that I am a newbie a programming. I am having a problem compiling a sample source code that I downloaded from microsoft. When I try to build the program I get...
3
by: Anna Smidt | last post by:
Thanks for the help so far. I have some problems left. One of them is an undeclared identifier, but it's unclear to me why the compiler fights with me. It says "iter: undeclared identifier" I...
1
by: LuxCkrown | last post by:
Hey everyone, i've been browsing for a fix to my problem 1>c:\documents and settings\user\desktop\judis_repack\judis repack\judis repack\maplestoryserver\inventory.cpp(386) : error C2065: 'amount'...
7
by: Adam01 | last post by:
Im using cygwin to test the code of a server I am writing. I've included sys/types.h, sys/socket.h, netdb.h, and arpa/inet.h. And this is the output.. ../../../sockets.cpp: In constructor...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.