Error C2065 Enum Idd
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error C2065 when using two MFC projects up vote 1 down vote favorite I have a Dialog with a CListCtrl with some data, below is a button. My second project is a dialog with a tri-state checkbox. Now I want to couple both projects, so when selecting a list item and clicking the button the tristate dialog appers showing something. Well, I added the second project to another one and changed its type to .dll, but receive a build error error C2065: 'IDD_MFCAPP2_DIALOG' : undeclared identifier IDD_MFCAPP2_DIALOG is the id of he checkbox dialog. When adding the project both id's had the same value, so I changed this in resource.h manually to a different one, but it did not solve the problem. The projects work very well separately. What do I miss? UPDATE: I have reduced the project to a minimum, the problem is the same MFCApp1Dlg.h class CMFCApp1Dlg : public CDialogEx { // Construction public: CMFCApp1Dlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_MFCAPP1_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: afx_msg void OnBnClickedButtonChange(); CButton m_BtnChange; }; Its cpp file only contains the standard things. Just the button handler calls other app void CMFCApp1Dlg::OnBnClickedButtonChange() { CMFCApp2Dlg dlg; if (dlg.DoModal()) { // do something... } } MFCApp2Dlg.h looks the same class CMFCApp2Dlg : public CDialogEx { // Construction public: CMFCApp2Dlg(CWnd* pParent = NULL); // standard constructor // Dialog Data enum { IDD = IDD_MFCAPP2_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() }; The .rc file are also not spectaculary IDD_MFCAPP1_DIALOG DIALOGEX 0, 0, 315, 151 STYLE DS_SETFONT | DS_F
Forum Visual C++ & C++ Programming Visual C++ Programming error C2065: 'IDD_DIALOG1' : undeclared identifier If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register or Login before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Page 1 of 2 12 Last Jump to page: Results 1 to 15 of 18 http://stackoverflow.com/questions/20263770/error-c2065-when-using-two-mfc-projects Thread: error C2065: 'IDD_DIALOG1' : undeclared identifier Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode August 17th, 2004,05:22 AM #1 d00_ape View Profile View Forum Posts Visit Homepage Member Join Date Oct 2003 Location Sweden Posts 381 error C2065: 'IDD_DIALOG1' : undeclared identifier How come http://forums.codeguru.com/showthread.php?306556-error-C2065-IDD_DIALOG1-undeclared-identifier I got the following error when including my dialog1.h file twice in separate files. The compiler brakes at: Code: class CDialog1 : public CDialog { // Construction public: CDialog1 (CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CADTTOSIMDialog) enum { IDD = IDD_ CDIALOG1 }; // BRAKES HERE AND GIVES THE ERROR: error C2065: 'IDD_DIALOG1' : undeclared identifier //}}AFX_DATA … }; … This error is followed by the “error C2057: expected constant expression” Thanks ...and justice for all Reply With Quote August 17th, 2004,05:41 AM #2 Vaderman View Profile View Forum Posts Member + Join Date May 2004 Location London, England Posts 563 you need to create a control with that particular ID, in this case a Dialog, with the ID of IDD_CDIALOG1. Tthe code that you posted looks as if you've simply cut'n'pasted your code as the AFX declaration is different to the name of your class, and you've tried to insert a resouce ID that does not exist : Code: class CDialog1 : public CDialog { // Construction public: CDialog1 (CWnd* pParent = NULL); // standard constructor /
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick http://www.codeproject.com/Questions/211208/MFC-Dialog-Box-Question answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business http://computer-programming-forum.com/82-mfc/d69e5d5c5b4404ba.htm Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free error c2065 Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most error c2065 enum Valuable Professionals The Lounge  The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ MFC Dialog Box Question Rate this: Please Sign up or sign in to vote. See more: C++ Visual-Studio MFC VS2010 So, I am continuing to work through a tutorial and I have run into another 'undeclared identifier' error. I have checked that the definition exists in resource.h, but I still get the error. Again, it is a short tutorial, so here is the code: //MFC5.CPP - MFC Tutorial Part 5 from CoderSource.net #include
code with class wizard: class CInputBox : public CDialog { public: CInputBox(CWnd* pParent = NULL); enum { IDD = IDD_DIALOG1 }; protected: virtual void DoDataExchange(CDataExchange* pDX); protected: DECLARE_MESSAGE_MAP() Quote:}; However the line "enum {IDD=IDD_DIALOG1};" generates an UNDECLARED IDENTIFIER error at build time. I do not understand this. I thought it was a declaration. So where and what does it want? I thought Class Wizard would do it for me. regards Peter Davy (New Zealand) -- Fri, 01 Sep 2000 03:00:00 GMT Peter Dav#2 / 3 Undeclared Identifier Hi MSVC++ V5 When I create a new dialogue box for an app and give it a new class it creates the following code with class wizard: class CInputBox : public CDialog { public: CInputBox(CWnd* pParent = NULL); enum { IDD = IDD_DIALOG1 }; protected: virtual void DoDataExchange(CDataExchange* pDX); protected: DECLARE_MESSAGE_MAP() Quote:}; However the line "enum {IDD=IDD_DIALOG1};" generates an UNDECLARED IDENTIFIER error at build time. I do not understand this. I thought it was a declaration. So where and what does it want? I thought Class Wizard would do it for me. regards Peter Davy (New Zealand) -- -- Fri, 01 Sep 2000 03:00:00 GMT Yury Kos#3 / 3 Undeclared Identifier Quote: >Hi >MSVC++ V5 >When I create a new dialogue box for an app and give it a new class it >creates the following code with class wizard: >class CInputBox : public CDialog >{ >public: > CInputBox(CWnd* pParent = NULL); > enum { IDD = IDD_DIALOG1 }; > protected: > virtual void DoDataExchange(CDataExchange* pDX); >protected: >DECLARE_MESSAGE_MAP() >}; >However the line "enum {IDD=IDD_DIALOG1};" generates an UNDECLARED >IDENTIFIER error at build time. I do not understand this. I thought it was >a declaration. So where and what does it want? I thought Class Wizard would >do it for me. >regards >Peter Davy (New Zealand) >-- >-- Hi Peter, The IDD_WHATEVER so as IDC_WHATEVER go to the resource.h. You have somehow include resource.h. Ususally the resource.h is invoked through yourapp.h file, which is included by all other files in the project. In case you setup your project so that resource.h endup in the precompiled header you'll have to force it to rebuild (like reabuild all), because VC doesn't generate the dependency on resource.h Yury Kosov CoreTek,