简体   繁体   English

Typedef函数指针错误

[英]Typedef function pointer error

I'm trying to compile some legacy C++ project and ran into an error, and I can't figure out what's going on. 我试图编译一些旧的C ++项目并遇到错误,但我不知道发生了什么。

The error is in this line (18): 错误在此行(18):

 typedef uint16_t (*vfunc)();

GCC output: GCC输出:

vflow.h:18: warning: ISO C++ forbids declaration of 'uint16_t' with no type
vflow.h:18: error: typedef 'uint16_t' is initialized (use decltype instead)
vflow.h:18: error: 'vfunc' was not declared in this scope

My C++ is even worse than my English; 我的C ++甚至比我的英语还差。 please help. 请帮忙。 =) =)

Transferring my comment to an answer: 将我的评论转移到答案:

Have you included either <stdint.h> or <cstdint> beforehand so you have uint16_t defined? 您是否预先包含了<stdint.h><cstdint>以便定义了uint16_t It looks like you don't yet have uint16_t defined. 看来您尚未定义uint16_t

Judging from the response, this is your problem. 从响应来看,这是您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM