c - 预期标识符或 '(' XCode C 指针函数

标签 c xcode function-pointers

我在这里读到这是 xcode 中最烦人的错误之一,请帮忙: 我有一个 C 代码,可以在 Android 上编译并运行,但不能在 iOS 上运行:

.h 文件:

typedef int (*encoding_function)(const short * a_input, unsigned char * a_output, const int a_len);
typedef int (*decoding_function)(unsigned char * a_input, short * a_output, const int a_len);
void set_encoding_func(encoding_function a_encoding_func);
void set_decoding_func(decoding_function a_decoding_func);

第一个c文件:

decoding_function real_decoding_func;
void set_decoding_func(decoding_function a_decoding_func)
{
    real_decoding_func = a_decoding_func;
}//- HERE IS THE ERROR!!!!!

第二个 c 文件 - 没有错误!!!

encoding_function real_encoding_function;
void set_encoding_func(encoding_function a_encoding_func)
{
    real_encoding_function = a_encoding_func;
}

编辑:删除代码后,我收到错误“Expected unqualified-id”。

最佳答案

我的代码没有出现任何错误。 检查您是否包含头文件。

关于c - 预期标识符或 '(' XCode C 指针函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36532430/

相关文章:

c - 如何将 c 函数注入(inject)或动态加载到另一个 c 程序中

linux-kernel - Linux 内核的静态调用图生成

c++ - 通过函数指针调用 C++ 成员函数

c - 如何管理二维字符数组?

c++ - libqmi应该如何链接?

xcode - 当我杀死一个应用程序时它崩溃了,该怎么办?

ios - 如何更改按钮单击时 UICollectionView 的高度

c++ - 编译结果报错 "undefined symbols for architecture i386"

c - 函数指针变量声明中的拼写错误,但代码编译

c - C 和 strcpy 中的字符串指针数组