日期:2014-05-16  浏览次数:20654 次

extern 的疑问:
simple.c   :

int   myextern(int   a)
{
  int   b;
  b=a*3;
  return   b;
}


hello.c   :

#include   <stdio.h>
extern   int   myextern(int   a);
int   main(){
      int   input=10;
      int   output;
      output=myextern(input);
      return   output;
}

这两个文件都位于/root下,用gcc   -o   hello   hello.c出错.请问该怎么用?

------解决方案--------------------
gcc -o hello hello.c sample.c
------解决方案--------------------
你编译不加上sample.c怎么能找到extern的函数?
gcc -o hello sample.c hello.c