# gcc -fPIC -c sum.c sub.c mul.c div.c
# gcc -shared -Wl,-soname,libmycalcso.so.1 -o libmycalcso.so.1.0.1 sum.o sub.o mul.o div.o
# ln -s libmycalcso.so.1.0.1 libmycalcso.so
# gcc -o simplecalcso simplecalc.c -L./ -l mycalcso
# ./simplecalcso
./simplecalcso: error while loading shared libraries: libmycalc.so: 
cannot open shared object file: No such file or directory
# cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

/usr/local/boost_1_48_0/libs
# sudo cp ./libmycalcso.so.1.0.1 /usr/local/boost_1_48_0/libs/
# ./simplecalcso
sum : 1225
sub : 1175
mul : 30000
div : 48
#
# ldd simplecalc
        linux-vdso.so.1 =>  (0x00007ffe6f7fd000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f08f2758000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f08f2b1d000)
#

'Programming > Linux Coding' 카테고리의 다른 글

Ex10. Makefile - lv1  (0) 2016.02.24
Ex09. mycopy.c  (0) 2016.02.22
Ex07. simplecalc.c - libmycalc.a (static library)  (0) 2016.02.22
Ex06. simplecalc.c  (0) 2016.02.22
Ex05. userinfo.c  (0) 2016.02.22

+ Recent posts