Issue with transfer CMFCPropertySheet from ISO C++ 17 to OSO C++ 20

George Yaroshevsky 1 Reputation point
2021-08-30T01:56:21.877+00:00

It is MFC VC++ Visual Studio 2019 Community Update 16.11.2 under Win 10

My peoject is CMFCPROPERTY SHEET app.

For each property page Visual studio entered the constructor:

class CPgTraining : public CMFCPropertyPage
{
  DECLARE_DYNAMIC(CPgTraining)

public:
  CPgTraining::CPgTraining(): CMFCPropertyPage(CPgTraining::IDD)
 {
   m_psp.dwFlags &= ~PSP_HASHELP;
 }
 ..................................................

All is compiled just fine under ISO C++17.
But under ISO C++20 I am getting error:

1>PgNetData.cpp
1>D:\VS2019\StorageTmp\ANNet\ANNet\PgTraining.h(19,15): error C3254: 'CPgTraining': class contains explicit override '{ctor}' but does not derive from an interface that contains the function declaration
1>D:\VS2019\StorageTmp\ANNet\ANNet\PgTraining.h(19,28): error C3244: 'CPgTraining::CPgTraining(void)': this method was introduced by '<Unknown>' not by 'CMFCPropertyPage'
1>For every CMFCPropertyPage in the roject.

Removing initialization for base class is leading to exception.

How to correct it?

Windows development | Windows API - Win32
Developer technologies | C++
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2021-08-30T06:47:30.027+00:00

    Hi,

    I agree with IgorTandetnik-1300, you should try to use the following code.

    CPgTraining(): CMFCPropertyPage(CPgTraining::IDD)  
    

    If you set Conformance Mode to /permissive-, the same error was also recovered under ISO C++17.

    ![127524-image.png

    Best Regards,

    Jeanine


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.