Hello,
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:
Code:
g++ -fPIC -c special.cpp
g++ -shared -Wl,-soname,libspecial.so.1 -o libspecial.so.1.0 special.o
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/ .
After invoking the compiler
Code:
g++-4.2 -Wall -g -o lib lib.cpp -I$MYLIB/include -L$MYLIB/lib -lspecial
i got a nice little error, complaining my library would not exist:
Code:
/usr/bin/ld: cannot find -lspecial
collect2: ld returned 1 exit status
What went wrong?
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.