Typically, it will check /lib, /usr/lib as default library folder while running.
But if your program is using library from another folder,
you should specify it use -L option in gcc:
gcc -Wall hello.c -L/usr/local/lib/x86_64-linux-gnu -lhello -o hello
It will load libhello.so in /usr/local/lib/x86_64-linux-gnu folder
But I still get error after running above command.
To fix it:
$ sudo ldconfig /usr/local/lib/x86_64-linux-gnu
Then build again, it can run successfully.
沒有留言:
張貼留言