MFC C ++应用程序无法编译 [英] MFC C++ App fails to compile

查看:90
本文介绍了MFC C ++应用程序无法编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照MFCAnimationWalkthrough示例的说明进行操作。在进行任何更改之前,VS2017社区编译了Debug / x86和Release / x64配置。 完成所有更改后,两个配置都无法编译,在MFCAnimationWalkthroughView类的Animate方法中,调试/ x86的8个错误​​
和以3个语句为中心的Release / x64的5个错误。 该方法的代码如下,3个语句以粗体显示:


void CMFCAnimationWalkthroughView :: Animate(BOOL bDirection)

{

     m_bCurrentDirection = bDirection;

    静态UI_ANIMATION_SECONDS持续时间= 3;

     static DOUBLE dblSpeed = 35。;
$
     static BYTE nStartColor = 50;

     static BYTE nEndColor = 255;

     BYTE nRedColorFinal = bDirection nStartColor:nEndColor;

     BYTE nGreenColorFinal = bDirection nStartColor:nEndColor;

     BYTE nBlueColorFinal = bDirection nStartColor:nEndColor;

     CLinearTransition * pRedTransition =

         new CLinearTransition(duration,(DOUBLE)nRedColorFinal);

     CSmoothStopTransition * pGreenTransition =

         new CSmoothStopTransition(duration,(DOUBLE)nGreenColorFinal);

     CLinearTransitionFromSpeed * pBlueTransition =

         new CLinearTransitionFromSpeed(dblSpeed,(DOUBLE)nBlueColorFinal);

     m_animationColor.AddTransition(pRedTransition,

       pGreenTransition,

       pBlueTransition);

     CRect rectClient;

     GetClientRect(rectClient);

     rectClient.top + = nInfoAreaHeight;

     int nLeftFinal = bDirection? rectClient.left:rectClient.CenterPoint()。x;

     int nTopFinal = bDirection? rectClient.top:rectClient.CenterPoint()。y;

     int nRightFinal = bDirection? rectClient.right:rectClient.CenterPoint()。x;

     int nBottomFinal = bDirection? rectClient.bottom:rectClient.CenterPoint()。y;

     CLinearTransition * pLeftTransition =

         new CLinearTransition(duration,nLeftFinal);

     CLinearTransition * pTopTransition =

         new CLinearTransition(duration,nTopFinal);

     CLinearTransition * pRightTransition =

         new CLinearTransition(duration,nRightFinal);

     CLinearTransition * pBottomTransition =

         new CLinearTransition(duration,nBottomFinal);

     m_animationRect.AddTransition(pLeftTransition,

       pTopTransition,

       pRightTransition,

       pBottomTransition);

     CBaseKeyFrame * pKeyframeStart =

         CAnimationController :: GetKeyframeStoryboardStart();

     CKeyFrame * pKeyFrameEnd =

         m_animationController.CreateKeyframe(nAnimationGroup,

          pBlueTransition);

     pLeftTransition-> SetKeyframes(pKeyframeStart,pKeyFrameEnd);

     pTopTransition-> SetKeyframes(pKeyframeStart,pKeyFrameEnd);

     pRightTransition-> SetKeyframes(pKeyframeStart,pKeyFrameEnd);

     pBottomTransition-> SetKeyframes(pKeyframeStart,pKeyFrameEnd);

     m_animationController.AnimateGroup(nAnimationGroup);

}



错误对我没有任何意义 他们说一个";"在标签nStartColor之前丢失,标签在最后两个语句中重新查找。 搜索网络后发现了一些该方法的清单,其中
与我的三通相匹配。 他们没有表明有任何错误。



任何建议都将不胜感激!



问候!


解决方案

复制
https://social.msdn.microsoft.com/Forums/en-US/c4371bf2-a6f6-4f72-b498-fe5a1d83972b/mfc-app-in-vs2017-on-win10-fails?forum=vcgeneral


I've followed the instructions for the MFCAnimationWalkthrough example. VS2017 Community compiled both a Debug/x86 and a Release/x64 configuration before any changes were made.  After all changes were made both configurations failed to compile, 8 errors for the Debug/x86 and 5 errors for the Release/x64 centered on 3 statements in the Animate Method of the MFCAnimationWalkthroughView Class.  The code for that method follows and the 3 statements are in bold type:

void CMFCAnimationWalkthroughView::Animate(BOOL bDirection)
{
    m_bCurrentDirection = bDirection;
    static UI_ANIMATION_SECONDS duration = 3;
    static DOUBLE dblSpeed = 35.;
    static BYTE nStartColor = 50;
    static BYTE nEndColor = 255;
    BYTE nRedColorFinal = bDirection nStartColor : nEndColor;
    BYTE nGreenColorFinal = bDirection nStartColor : nEndColor;
    BYTE nBlueColorFinal = bDirection nStartColor : nEndColor;
    CLinearTransition* pRedTransition =
        new CLinearTransition(duration, (DOUBLE)nRedColorFinal);
    CSmoothStopTransition* pGreenTransition =
        new CSmoothStopTransition(duration, (DOUBLE)nGreenColorFinal);
    CLinearTransitionFromSpeed* pBlueTransition =
        new CLinearTransitionFromSpeed(dblSpeed, (DOUBLE)nBlueColorFinal);
    m_animationColor.AddTransition(pRedTransition,
        pGreenTransition,
        pBlueTransition);
    CRect rectClient;
    GetClientRect(rectClient);
    rectClient.top += nInfoAreaHeight;
    int nLeftFinal = bDirection ? rectClient.left : rectClient.CenterPoint().x;
    int nTopFinal = bDirection ? rectClient.top : rectClient.CenterPoint().y;
    int nRightFinal = bDirection ? rectClient.right : rectClient.CenterPoint().x;
    int nBottomFinal = bDirection ? rectClient.bottom : rectClient.CenterPoint().y;
    CLinearTransition* pLeftTransition =
        new CLinearTransition(duration, nLeftFinal);
    CLinearTransition* pTopTransition =
        new CLinearTransition(duration, nTopFinal);
    CLinearTransition* pRightTransition =
        new CLinearTransition(duration, nRightFinal);
    CLinearTransition* pBottomTransition =
        new CLinearTransition(duration, nBottomFinal);
    m_animationRect.AddTransition(pLeftTransition,
        pTopTransition,
        pRightTransition,
        pBottomTransition);
    CBaseKeyFrame* pKeyframeStart =
        CAnimationController::GetKeyframeStoryboardStart();
    CKeyFrame* pKeyFrameEnd =
        m_animationController.CreateKeyframe(nAnimationGroup,
            pBlueTransition);
    pLeftTransition->SetKeyframes(pKeyframeStart, pKeyFrameEnd);
    pTopTransition->SetKeyframes(pKeyframeStart, pKeyFrameEnd);
    pRightTransition->SetKeyframes(pKeyframeStart, pKeyFrameEnd);
    pBottomTransition->SetKeyframes(pKeyframeStart, pKeyFrameEnd);
    m_animationController.AnimateGroup(nAnimationGroup);
}

The errors didn't make any sense to me.  They said a ";" was missing before the label nStartColor and that the label was redefind in the last two statements in question.  A search of the web found a couple listings of that method which matched mine to a tee.  They didn't indicate that there were any errors.

Any suggestions would be greatly appreciated!

Regards!

解决方案

Duplicate of https://social.msdn.microsoft.com/Forums/en-US/c4371bf2-a6f6-4f72-b498-fe5a1d83972b/mfc-app-in-vs2017-on-win10-fails?forum=vcgeneral


这篇关于MFC C ++应用程序无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆