Que about visual c++

Last Edited By Krjb Donovan
Last Updated: Mar 11, 2014 07:52 PM GMT

Contents

QuestionEdit

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.

===================Edit
  1. include<afxwin.h>
  2. 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;

=========================Edit

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)

===================================Edit

Thanking you, Sanjeev

AnswerEdit

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

  1. 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.)

Advertisement

©2024 eLuminary LLC. All rights reserved.