You are here:

C++/que about Visual C++

Advertisement


Question
R/Sir
Colud you please help me in solving the error in my program's comiplation:
Below is the program:-
Program to attach a menu to a window.
===============================
#include<afxwin.h>
#include "resource.h"

class myframe : public CFrameWnd
{
  public :
     myframe()
     {
        Create(0, "Hello MFC", WS_OVERLAPPEDWINDOW,rectDefault,0,
              MAKEINTRESOURCE(IDR_MENU1));
     }
};

class myapp : public CWinApp
{
  public :
     int InitInstance()
     {
        myframe *p;
        p=new myframe;
p->ShowWindow(1);
m_pMainWnd=p;

return 1;
  }
};

myapp a;
=====================================
following error comes:-
--------------------Configuration: hello - Win32 Debug--------------------
Compiling...
f1.cpp
C:Program FilesMicrosoft Visual StudioMyProjectshello 1.cpp(2) : fatal error C1083: Cannot open include file: 'resource.h': No such file or directory
Error executing cl.exe.

hello.exe - 1 error(s), 0 warning(s)
===============================================
Thanking you,
Sanjeev

Answer
Make sure that you have a file called "resource.h" in the project directory which contains the line:

#define IDR_MENU1 <some number like 101>

(If you had created a resource (eg. menu) using the resource editor of Visual studio, this file would be automatically created.)

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++09. i would not answer questions about gui and web programming.

Experience

over 15 years

Education/Credentials
post graduate engineer

©2012 About.com, a part of The New York Times Company. All rights reserved.