简体   繁体   中英

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.

The error is in this line (18):

 typedef uint16_t (*vfunc)();

GCC output:

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; please help. =)

Transferring my comment to an answer:

Have you included either <stdint.h> or <cstdint> beforehand so you have uint16_t defined? It looks like you don't yet have uint16_t defined.

Judging from the response, this is your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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