You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Hello there, I'm sorry if my question is silly, but I really need help
I faced a trouble trying to created a shared library
First I got a static library file liblexbor_static.a , then created a shared library by
gcc -shared -o liblexbor.so liblexbor.a sudo mv liblexbor.so ~/../../lib/
Then I created main.c file and compiled an executable:
sudo gcc -L~/../../lib/liblexbor.so -Wall main.c -llexbor -o liblexbor.so.0.0.0 sudo mv liblexbor.so.0.0.0 ~/../../lib/
export LD_LIBRARY_PATH=~/../../lib/liblexbor.so:$LD_LIBRARY_PATH; ./liblexbor.so.0.0.0
to make it available at runtime
But it does not still work:
g++ Main.cpp -llexbor -o Exec ./Exec
g++ Main.cpp -llexbor -o Exec /usr/bin/ld: /tmp/ccGcCzq8.o: in function `serialize': Main.cpp:(.text+0x70): undefined reference to `lxb_html_serialize_pretty_tree_cb' /usr/bin/ld: /tmp/ccGcCzq8.o: in function `main': Main.cpp:(.text+0xd6): undefined reference to `lxb_html_document_create' /usr/bin/ld: Main.cpp:(.text+0x13c): undefined reference to `lxb_html_document_parse' /usr/bin/ld: Main.cpp:(.text+0x1fa): undefined reference to `lxb_html_document_destroy' collect2: error: ld returned 1 exit status
Please, help me fix this
Also I'd be really grateful if you helped me understand why do I export LD_LIBRARY_PATH=~/../../lib/liblexbor.so:$LD_LIBRARY_PATH
Maybe I should have mentioned that main.c consisted only of int main() <>
Beta Was this translation helpful? Give feedback.
2 You must be logged in to vote