MFC一些error问题

错误 LNK2019:无法解析的外部的符号 _sscanf和_vsprintf

在使用Visual Studio 编译的时候可能会遇到 ERROR LNK2019:无法解析的外部的符号 _sscanf, _sscanf_s这样的函数,特别是使用Visual Studio2017时:

解决方法:
方法一:点击项目属性,弹出属性对话框后,打开链接器点击输入,在附加依赖项中添加legacy_stdio_definitions.lib 即可。

方法二:在报错的.cpp文件中的头文件下面加#parameter(lib,"legacy_stdio_definitions.lib ")
提示:由于很多时候我们难以找到具体出错的.cpp文件,所以方法一更好用

E1097: unknown attribute "no_init_all" in WinNT.h in Windows SDK 10.0.18362.0

在我使用最新(2019.5.12)的VS2019(版本号16.0.3)时,编译器弹出了如标题所示错误,找不到"no_init_all"attribute。错误源头在winnt.h这一系统头文件中。

只需要在winnt.h头文件中

#if (_MSC_VER >= 1915)

#pragma warning(disable:4845)   // __declspec(no_init_all) used but d1initall not set

#endif

(这一代码块是微软工程师用于在旧版本的VS中消除该错误提示的预编译头
虽然微软的工程师们宣称他们在最新的VS2019中已经修复了该错误,但是仍有很多人受到了该错误的困扰。)

这一预编译头之后加上

#if (_MSC_VER >= 1915)

#define no_init_all deprecated

#endif

“ACCESS_MASK“不明确的符号 问题解决

opencv的命名控件 系统库名称冲突;
解决方式:
去除所有的using namespace cv
然后以cv::替代

directshow 遇到的问题

具体是d3dx9.h D3DApp.h D3DFont.h qedit.h不能共存,出现一下错误: 
should not include d3dtypes.h when compiling for DX8 or newer interfaces 
D:\DXSDK\Include\d3drmobj.h(46) : warning C4005: 'WIN_TYPES' : macro redefinition 
        D:\DXSDK\Include\dxfile.h(48) : see previous definition of 'WIN_TYPES' 
D:\DXSDK\Include\d3drmobj.h(274) : error C2061: syntax error : identifier 'LPDIRECT3D' 
D:\DXSDK\Include\d3drmobj.h(299) : error C2061: syntax error : identifier 'LPDIRECT3DDEVICE' 
D:\DXSDK\Include\d3drmobj.h(314) : error C2061: syntax error : identifier 'LPDIRECT3D' 
D:\DXSDK\Include\d3drmobj.h(339) : error C2061: syntax error : identifier 'LPDIRECT3DDEVICE' 
D:\DXSDK\Include\d3drmobj.h(344) : error C2061: syntax error : identifier 'LPDIRECT3D2' 
D:\DXSDK\Include\d3drmobj.h(348) : error C2061: syntax error : identifier 'LPDIRECT3DDEVICE2' 
D:\DXSDK\Include\d3drmobj.h(363) : error C2061: syntax error : identifier 'LPDIRECT3D' 
D:\DXSDK\Include\d3drmobj.h(388) : error C2061: syntax error : identifier 'LPDIRECT3DDEVICE' 
D:\DXSDK\Include\d3drmobj.h(393) : error C2061: syntax error : identifier 'LPDIRECT3D2' 
D:\DXSDK\Include\d3drmobj.h(397) : error C2061: syntax error : identifier 'LPDIRECT3DDEVICE2' 
D:\DXSDK\Include\d3drmobj.h(454) : error C2061: syntax error : identifier 'LPDIRECT3DVIEWPORT' 
D:\DXSDK\Include\d3drmobj.h(500) : error C2061: syntax error : identifier 'LPDIRECT3DVIEWPORT' 
D:\DXSDK\Include\d3drm.h(74) : error C2061: syntax error : identifier 'LPDIRECT3D' 
D:\DXSDK\Include\d3drm.h(156) : error C2061: syntax error : identifier 'LPDIRECT3D2' 
D:\DXSDK\Include\d3drm.h(240) : error C2061: syntax error : identifier 'LPDIRECT3D2' j

解决方法:#define __D3DRM_H__

 在"stdafx.h"文件中,加上 #define __D3DRM_H__ 就好了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值