locked
Cannot open include file: 'resource.h': No such file or directory RRS feed

  • Question

  • #include<afxwin.h>
    #include"resource.h"
    class myframe:public CFrameWnd
    {
    public:
    myframe()
    {
    LoadAcceLTable(MAKEINTRESOURCE(IDR_ACCELERATOR1));
    Create(0,"Accelerator",WS_OVERLAPPEDWINDOW,rectDefault,0,MAKEINTRESOURCE(IDR_MENU1));
    }
    void fun1()
    {
    MessageBox("Reached here to draw a ine","Title");
    }
    void fun2()
    {
    MessageBox("Reached here to draw a Rectangle","Title")
    }
    void fun3()
    {
    MessageBox("Reached here to draw a circle","Title")
    }
    void fun4()
    {
    MessageBox("Reached here to draw a Triangle","Title")
    }
    DECLARE_MESSAGE_MAP(myframe,CFrameWnd)
    ON_COMMAND(101,FUN1)
    ON_COMMAND(102,FUN2)
    ON_COMMAND(103,FUN3)
    ON_COMMAND(104,FUN4)
    END_MESSAGE_MAP()
    class myapp:public CWinApp
    {
    public:
    int InitInstance()
    {
    myframe *p;
    p=new myframe;
    p->ShowWindow(3);
    m_pMainwnd=p;
    return 1;
    }
    };
    myapp a;
    Saturday, August 6, 2016 4:52 AM

Answers

  • Hi Hukam,

    thanks for posting here.

    The resource.h is a header file generated by the development environment, for example Resource.h, that is referred to from an .rc file.

    Before solving this problem, you should have some knowledge of Resource Files. Please refer to this link below.

    https://msdn.microsoft.com/en-us/library/7zxb70x7.aspx?f=255&MSPPError=-2147217396

    For solving this problem, you could right click the Project menu->Add New Item. In the Add New Item dialog box, click the Visual C++ folder then choose Resource File (.rc) in the right pane.

    Or create a new MfC application using the wizard like RLWA32 suggested, it will generate a resource.h file.

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    • Proposed as answer by Baron Bi Tuesday, August 16, 2016 3:03 AM
    • Marked as answer by Hart Wang Wednesday, August 17, 2016 1:33 AM
    Monday, August 8, 2016 7:59 AM

All replies

  • Did you create the resource.h file that your code references? If so, is it in the correct location?

    I suggest that you use Visual Studio to create a new MfC application using the wizard.  After the application has been created you can study its structure and then customize it to add your own functions and  commands.

    Saturday, August 6, 2016 5:01 AM
  • Hi Hukam,

    thanks for posting here.

    The resource.h is a header file generated by the development environment, for example Resource.h, that is referred to from an .rc file.

    Before solving this problem, you should have some knowledge of Resource Files. Please refer to this link below.

    https://msdn.microsoft.com/en-us/library/7zxb70x7.aspx?f=255&MSPPError=-2147217396

    For solving this problem, you could right click the Project menu->Add New Item. In the Add New Item dialog box, click the Visual C++ folder then choose Resource File (.rc) in the right pane.

    Or create a new MfC application using the wizard like RLWA32 suggested, it will generate a resource.h file.

    Best Regards,

    Sera Yu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    • Proposed as answer by Baron Bi Tuesday, August 16, 2016 3:03 AM
    • Marked as answer by Hart Wang Wednesday, August 17, 2016 1:33 AM
    Monday, August 8, 2016 7:59 AM