当涉及全局变量时,我对在我的 c 代码中使用“extern”感到有些困惑。我尝试了以下方法,并得到了编译错误:
主要.c:
extern unsigned short *videobuffer;
//I also tried this in a separate and it failed with the same compilation error//
extern (unsigned short *)videobuffer;
lib.c:
unsigned short *videobuffer = (unsigned short *)0x6000000;
我收到的错误:
[COMPILE] Compiling main.c
main.c:16: error: expected identifier or '(' before 'unsigned'
make: *** [main.o] Error 1