Function 'UINT64_C' could not be resolved

如题,我们在使用Eclipse for C++时,通过增加定义-D__STDC_CONSTANT_MACROS, 可以使编译通过,但CDT的智能提示却总是报错, 通过一番查找,在stdint.h头文件中发现了它的定义:

/* The ISO C99 standard specifies that in C++ implementations these
   should only be defined if explicitly requested.  */
#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS

/* Signed.  */
# define INT8_C(c)	c
# define INT16_C(c)	c
# define INT32_C(c)	c
# if __WORDSIZE == 64
#  define INT64_C(c)	c ## L
# else
#  define INT64_C(c)	c ## LL
# endif

/* Unsigned.  */
# define UINT8_C(c)	c
# define UINT16_C(c)	c
# define UINT32_C(c)	c ## U
# if __WORDSIZE == 64
#  define UINT64_C(c)	c ## UL
# else
#  define UINT64_C(c)	c ## ULL
# endif

/* Maximal type.  */
# if __WORDSIZE == 64
#  define INTMAX_C(c)	c ## L
#  define UINTMAX_C(c)	c ## UL
# else
#  define INTMAX_C(c)	c ## LL
#  define UINTMAX_C(c)	c ## ULL
# endif

#endif	/* C++ && constant macros */

主要是这一句:
#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
由于我们的工程是c++的,第一个条件不满足, 第二个条件就是我们在编译时加入的宏定义,出现如题的错误肯定是这个宏定义了,但没有被智能识别程序识别。

解决方案:

1. 右键单击 c++ 工程,Properties>>C/C++ General>>Paths and Symbols>>Symbols>>GNU C++>>Add

2. 在弹出的对话框中输入Name:__STDC_CONSTANT_MACROS Values: 1

再到程序中按F3,是不是可以找到UINT64_C了?


通过此方法,你可以增加其它的宏,以供智能识别程序识别。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值