gcc -shared option flag


gcc -shared generates shared object file for shared library.

Syntax

$ gcc -shared [options] [source files] [object files] [-o output file]

Example???

myfile.c:

// myfile.c
#include <stdio.h>

int main()
{
    printf("Program run!\n");
    int i=10;
}

 

Regular build of myfile.c gives no messages:

$ gcc myfile.c -o myfile
$

 

Build of myfile.c with -Wall:

$ 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
$

 


See also

GCC
CONTACT