gcc -shared為共享庫生成共享對象文件。
$ gcc -shared [options] [source files] [object files] [-o output file]
myfile.c:
// myfile.c
#include <stdio.h/
int main()
{
printf("Program run!\n");
int i=10;
}
常規構建myfile.c不會顯示任何消息:
$ gcc myfile.c -o myfile
$
使用-Wall構建myfile.c:
$ gcc -Wall myfile.c -o myfile
myfile.c In function 'main':
myfile.c:6:6: warning: unused variable 'i'
myfile.c:7:1: warning: control reaches end of non-void function
$