C 如何访问转换单元外的typedefed对象

C 如何访问转换单元外的typedefed对象,c,C,测试h 职能c main.c 此操作失败,错误为对象“funcptr”不是函数或函数指针 我是否违反了这里的基本规则?语法错误;应该是 extern FPTR funcptr; 因为一个外部人员仍然需要提到一个类型 您最好使用*funcptr来调用它,它至少更具可读性。oops!那很容易。。很抱歉给大家带来麻烦,谢谢你们抽出时间。我也接受你的第二个建议。 #include "test.h" static int x = 22; // persistent with external lin

测试h

职能c

main.c

此操作失败,错误为对象“funcptr”不是函数或函数指针


我是否违反了这里的基本规则?

语法错误;应该是

 extern FPTR funcptr;
因为一个外部人员仍然需要提到一个类型


您最好使用*funcptr来调用它,它至少更具可读性。

oops!那很容易。。很抱歉给大家带来麻烦,谢谢你们抽出时间。我也接受你的第二个建议。
#include "test.h"

static int x = 22; // persistent with external linkage.

int func(void)
{
  extern int x; // Referencing declaration
  static int count = 0; // persistent within block
  printf("%d : %d\n",++count,++x);
return 1;
}

FPTR funcptr = func; // persistent with external linkage. ??
#include "test.h"

#include <stdio.h>

extern funcptr; // referencing declaration ??

int main(void)
{
func();
funcptr(); // Compile Time Error Here
return 0;
}
 extern FPTR funcptr;