error C3861: 'assert': identifier not found
来源:互联网 发布:mysql事务隔离级别 编辑:程序博客网 时间:2024/05/21 06:39
编译环境:VS2005
工程配置:
程序增加如下代码:
#include <assert.h>//包含C标准库,断言库
assert((1 == number) || (2 == number) || (3 == number) || (4 == number) || (5 == number));//assert 是c标准里的一个宏
目的:在DEBUG版本中检查API接口输入参数number)的合法性,在release版本中断言不起作用。PS如下表格:
assert ASSERT VERIFY 区别
编译报错:error C3861: 'assert': identifier not found
度娘告诉我:
assert 是c标准里的一个宏(在assert.h中定义),而ASSERT是MFC的一个宏(在afx.h定义)
#define assert(_Expression) (void)( (!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression), _CRT_WIDE(__FILE__), __LINE__), 0) )
#define ASSERT(f) DEBUG_ONLY((void) ((f) || !::AfxAssertFailedLine(THIS_FILE, __LINE__) || (AfxDebugBreak(), 0)))
解决办法:
要么使用assert,要么使用ASSERT,但工程里不能同时包含这两个宏的定义,由于MFC里必然包含了ASSERT宏,因此在这里不能使用c标准库里的assert宏。因此改为ASSERT((1 == number) || (2 == number) || (3 == number) || (4 == number) || (5 == number));就OK了。
- error C3861: 'ASSERT': identifier not found
- error C3861: 'assert': identifier not found
- error C3861: 'cvCreateHidHaarClassifierCascade': identifier not found
- error C3861: 'TryEnterCriticalSection': identifier not found
- error C3861: 'round': identifier not found
- error C3861: 'round': identifier not found
- WTL error C3861: 'DDX_Control': identifier not found
- error C3861: identifier not found | 找不到标识符
- “error C3861: 'random': identifier not found”解决办法
- error C3861: 'AtlLoadSystemLibraryUsingFullPath': identifier not found
- error C3861: ‘back_inserter': identifier not found
- Error 13 error C3861: 'GetPrivateProfileString': identifier not found
- Visual Studio 2005 提示 error C3861: 'SHCreateDirectory': identifier not found
- vs2005 下error C3861: 'GetEventData': identifier not found 解决方法
- libavutil\common.h(184) : error C3861: 'UINT64_C': identifier not found
- error C3861: “setw”: 找不到标识符;error C3861:'setw': identifier not found
- error C2065: 'fstream' : undeclared identifier error C3861: 'opfile': identifier not found
- ffmpeg error C3861: 'UINT64_C': identifier not foun
- mime-types-data requires Ruby version >= 2.0
- 单项数据绑定、双向数据绑定及其原理(脏检查)
- php验证码制作
- 解决Error:Android Dex: com.android.dex.DexIndexOverflowException: Cannot merge new index 65918 into a
- js排序算法总结—冒泡,快速,选择,插入,希尔,归并
- error C3861: 'assert': identifier not found
- unity-Navigation寻路-添加障碍物Obstacle
- always assign的区别
- css3 三级菜单导航栏
- FusionCharts在服务器端导出图片(J2EE版)
- Vector3 三维向量
- BZOJ 2115: [Wc2011] Xor
- 北极熊扫描器4.0发布,无需过多介绍的国产安全工具
- 第八周【项目二-建立链串的算法库】