• VS2003转VS2010 fatal error C1189: #error


    我自己的mfc的demo要转换编译环境出现以下编译错误:

    VS2010编译错误:fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403...的解决方法

    在google中找到解决办法,

    _WIN32_WINNT这个宏对应定义的系统的版本号,如果太低的话,编译器就会认为代码无法在当前的系统上编译。

      说了原因,下面是修改方法,就是在stdafx.h文件中修改相关的定义,修改完后的效果应该如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    #ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
    #define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
    #endif
     
    #ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
    #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
    #endif
     
    #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
    #define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
    #endif
     
    #ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
    #define _WIN32_IE 0x0601 // Change this to the appropriate value to target IE 5.0 or later.
    #endif

    但编译后又出现以下问题:

    1> stdafx.cpp
    1>d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxwin.h(4024): error C2061: 语法错误: 标识符“PSCROLLBARINFO”
    1>d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxwin4.inl(184): error C2065: “PSCROLLBARINFO”: 未声明的标识符
    1>d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxwin4.inl(184): error C2146: 语法错误: 缺少“)”(在标识符“pScrollInfo”的前面)
    1>d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxwin4.inl(184): error C2761: “BOOL CScrollBar::GetScrollBarInfo(void) const”: 不允许成员函数重新声明
    1>d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxwin4.inl(184): error C2059: 语法错误:“)”
    1>d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxwin4.inl(185): error C2143: 语法错误 : 缺少“;”(在“{”的前面)
    1>d:program filesmicrosoft visual studio 10.0vcatlmfcincludeafxwin4.inl(185): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
    

      比较郁闷。。。。

    #ifndef WINVER				// 允许使用 Windows 95 和 Windows NT 4 或更高版本的特定功能。
    //#define WINVER 0x0400		//为 Windows98 和 Windows 2000 及更新版本改变为适当的值。 刚刚此处没有修改
    #define WINVER 0x0501	
    #endif
    

      现在应该正常。

    参考网友:

    http://www.cnblogs.com/madhenry/archive/2011/06/29/2093678.html

    http://blog.csdn.net/cs_21cn/article/details/7925455

  • 相关阅读:
    DokuWiki 插件使用
    DokuWiki 命名空间管理
    Ubuntu 14.10 下DokuWiki安装
    Ubuntu 14.10 下安装Ambari
    Ubuntu 14.10 下安装Ambari 问题汇总
    Hadoop 权限管理
    Spark 性能调优-内存设置-GC设置
    Ubuntu 14.10 下NodeJS Cannot find module 'npmlog'
    Hadoop 新增删除节点
    Ubuntu 14.10 下开机不进入图形化界面
  • 原文地址:https://www.cnblogs.com/logy/p/3358484.html
Copyright © 2020-2023  润新知