c++ - Understanding names of shared library in linux -
I have read the Linux documentation project and I still do not understand that
soname and < Code> real name . I have three files: main.cpp , header.h and test.cpp . I wrote the following Makefile: bin: main.o test.so g ++ -o bin main.o -ltest -Wl, -rpath / usr / local / lib main.o: Main CPP G ++ CCD CPP test. Type: test.og ++ -shared -o libtest.so test.o test.o: test.cpp g ++ -fPIC -c test.cpp clear: rm -f * .o * .so * bin I have run this make file, I have copied libtest.so in / usr / local / lib and it Okay. But I do not understand what is sonam and real name in my case? To recreate this makefile:
Bin: Main Test.so G ++ -O bin Main.O-El-Altest -Wl, -rpath Main. O: Main CPP G ++ - C Main CPP Test. Association: test.o G ++ -share-WL, Sonam, -Listest SO-1-O LIBSTEST.So.1.0.1 Test. O Test. O: Clear test.cpp g ++ -fPIC -c test.cpp: rm -f * .o * .so * bin but it does not work. The reason for the following error was:
/ usr / bin / ld: can not be found -ltest collect2: error: ld 1 exit status
but it does not work. The reason for the following error was: / usr / bin / ld: can not be found - ltest
It seems that you use the wrong option
1) - The Rape Runtime Library is for the search path. All-Roth arguments are added and add runtime linker ld.so See man ld.so . 2) For L - ld linking to your program or shared library (it is from man ld : All-L option is all- L option apply) Where to find the lynch ( ld libraries - ld.so is used when you Start your program, ld when you link it): G ++ -O bin main.o -l -ltest -wl, -rpath / usr / local / lib
Comments
Post a Comment