Problems using/creating a shared library
recently i tried to compile a program using a library i had created following a short instructed tutorial - without success.
To get the library from the file special.cpp i had used the following two commands:
Afterwards i copied libspecial.so and libspecial.so.1 to $MYLIB/lib/ ($MYLIB is just a directory somewhere under my /home/"username"/ directory) and a header with declarations (special.h) to $MYLIB/lib/ .
g++ -fPIC -c special.cpp
g++ -shared -Wl,-soname,libspecial.so.1 -o libspecial.so.1.0 special.o
After invoking the compiler
i got a nice little error, complaining my library would not exist:
g++-4.2 -Wall -g -o lib lib.cpp -I$MYLIB/include -L$MYLIB/lib -lspecial
What went wrong?
/usr/bin/ld: cannot find -lspecial
collect2: ld returned 1 exit status
By the way, this is my third approach to post this. I might be a bit confused, as i hit the back button of my browser two times in order to correct a mistake - after being forced to login again, i realized this is the wrong procedure to correct a misspelled word :P.