gcc -fPIC option flag

gcc -fPIC generates position independent code (PIC) for shared libraries.

Syntax

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

 

Use -fpic instead of -fPIC to generate more efficient code, if supported by the platform compiler.

Example

Write source file myfile.c:

// myfile.c
#include <stdio.h>
 
int myfunc()
{
    printf("myfunc\n");
}

 

Build myfile.c generates myfile.o:

$ gcc -fPIC -c myfile.c
$

 


See also

Write how to improve this page


email on- 00shivasharma@gmail.com
GCC
RAPID TABLES