The error is occurring because the typedef keyword is being used incorrectly.

In C++, typedef is used to create an alias for a data type. However, in the given code, typedef is being used to create an alias for a function pointer type.

To fix the error, the code should be modified as follows:

typedef void (*CallbackType)(int);
void callCallback(CallbackType callback, int progress);

This code defines a typedef for a function pointer type named CallbackType, which takes an int parameter and returns void. The callCallback function then takes a parameter of type CallbackType and an int parameter

typedef void CallbackTypeint i;void callCallbackCallbackType callback int progress;编译报错error expected identifier or before typedef

原文地址: https://www.cveoy.top/t/topic/hXOJ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录