1

Visual Studio 2017: I created a Windows project (Windows desktop wizard -> Windows App(Empty)).

Set MFC to use MFC in a shared DLL. Included <afxwin.h>.

And got a plenty of remarks in error list.

Image

Code is here:

#include <afxwin.h>

class CMyWnd : public CFrameWnd
{
public:
    CMyWnd()
    {
        Create(nullptr, _T("Just an stupid app ,isn`t it?"));
    }
};

class CMyApp : public CWinApp
{
public:
    virtual BOOL InitInstance() override;
};

BOOL CMyApp::InitInstance()
{
    m_pMainWnd = new CMyWnd;
    m_pMainWnd->ShowWindow(SW_NORMAL);
    return TRUE;
}
CMyApp MainApp;

However, the program works. What is going on? How can I repair it or just turn off errors in this header? (I am a bit new here so please correct me if I am not right anywhere) Thanks!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Bu Alex
  • 11
  • 4
  • You are missing header files. Go to File->New, create a new MFC project "dialog based application", then change the code to what you have now. – Barmak Shemirani Aug 09 '18 at 19:44
  • but why i cant just make it from the "plain windows project"? I can compile it.It works, even more the same project in VS 2015 I dont get such a bad mistakes.I just want to understand what a difference (cause I am reading now Hortons book Beggining Visual c++ 2013).Thanks for decision it works)) – Bu Alex Aug 10 '18 at 10:23
  • These are intellisense errors of the MFC source, which can be ignored. You can remove these from the error output via the drop-down field on the top right of the error window (press the small arrow button on the right to see it). – zett42 Aug 10 '18 at 17:07
  • Thanks! That what I wanted! – Bu Alex Aug 11 '18 at 09:27

0 Answers0