extern 的疑问:解决办法

extern 的疑问:解决办法

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

extern 的疑问:解决办法

相关文章:

你感兴趣的文章:

标签云: