GCC COMMANDLINE OPTIONS PART 5

commandline session

$cat main.c
#include<stdio.h>
#include<math.h>

int main(void)
{
   int i;
   float y;
   printf("n The Geek Stuff [%d]n", i);
   y=sinf(2.5);
   printf("%fn",y);
   return 0;
}
$gcc main.c
$./a.out

 The Geek Stuff [0]
0.598472
$gcc main.c -lmath
/usr/bin/ld: cannot find -lmath
collect2: error: ld returned 1 exit status
$gcc main.c -llibmath
/usr/bin/ld: cannot find -llibmath
collect2: error: ld returned 1 exit status
$gcc -Wall main.c
main.c: In function ‘main’:
main.c:8:10: warning: ‘i’ is used uninitialized in this function [-Wuninitialized]
$gcc -Wall main.c -llibImath
main.c: In function ‘main’:
main.c:8:10: warning: ‘i’ is used uninitialized in this function [-Wuninitialized]
/usr/bin/ld: cannot find -llibImath
collect2: error: ld returned 1 exit status
$gcc -Wall main.c -lImath
main.c: In function ‘main’:
main.c:8:10: warning: ‘i’ is used uninitialized in this function [-Wuninitialized]
/usr/bin/ld: cannot find -lImath
collect2: error: ld returned 1 exit status
$gcc -Wall main.c -l Imath
main.c: In function ‘main’:
main.c:8:10: warning: ‘i’ is used uninitialized in this function [-Wuninitialized]
/usr/bin/ld: cannot find -lImath
collect2: error: ld returned 1 exit status
$gcc  main.c -lImath
/usr/bin/ld: cannot find -lImath
collect2: error: ld returned 1 exit status
$gcc  main.c -lImath
/usr/bin/ld: cannot find -lImath
collect2: error: ld returned 1 exit status
$ln -s /usr/lib/libImath.so.6
libImath.so.6      libImath.so.6.0.0
$ln -s /usr/lib/libImath.so.6.0.0 /usr/lib/libImath.so
ln: failed to create symbolic link `/usr/lib/libImath.so': Permission denied
$sudo ln -s /usr/lib/libImath.so.6.0.0 /usr/lib/libImath.so
$gcc  main.c -lImath
$

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s