请大家帮忙看下这个编译异常

请大家帮忙看下这个编译错误!
文件t1.c:

#include <stdio.h>
static char *title = NULL;

void set_title(char *s)
{
  title = s;
}

int main(void)
{
  printf(title);
  return 0;
}

文件t2.c:
extern void set_title(char *s);
set_title("test");

命令:
gcc -Wall -c t1.c
ar rv libt.a t1.o
gcc -Wall -L. -lt t2.c -o t2
这一步时就出现:
t2.c:2:14: error: expected declaration specifiers or ‘…’ before string constant
这是什么出错了!! 谢谢了.


t2.c 里面这个函数出错了?

C/C++ code

set_title("test");

请大家帮忙看下这个编译异常

相关文章:

你感兴趣的文章:

标签云: