编译步骤
gcc test_a.c test_b.c -fpic -shared -o libtest.so
gcc test.c -l. -ltest -o test
./test
解决链接库问题:
#vim /etc/profile
ld_library_path=/mnt/hgfs/ubuntu_shared/so:$ld_library_path
export ld_library_path
# source /etc/profile
编译步骤
gcc test_a.c test_b.c -fpic -shared -o libtest.so
gcc test.c -l. -ltest -o test
./test
解决链接库问题:
#vim /etc/profile
ld_library_path=/mnt/hgfs/ubuntu_shared/so:$ld_library_path
export ld_library_path
# source /etc/profile