On Feb 25, 1:49 pm, Markus Kossmann <[EMAIL PROTECTED]> wrote: > vivekian wrote: > > Hi , > > > These are the steps i followed to create a shared library > > > 1. Compiled the cpp files > > > g++ -c -g -fpic -Wall -Wno-deprecated SockException.cpp -o > > SockException.o > > g++ -c -g -fpic -Wall -Wno-deprecated Socket.cpp -o Socket.o > > g++ -c -g -fpic -Wall -Wno-deprecated TcpSocket.cpp -o TcpSocket.o > > g++ -c -g -fpic -Wall -Wno-deprecated UdpSocket.cpp -o UdpSocket.o > > g++ -c -g -fpic -Wall -Wno-deprecated SocketReaderWriter.cpp -o > > SocketReaderWriter.o > > g++ -shared -Wl,-soname,libcppsocket.so.1 -o libcppsocket.so.1.0.1 > > SockException.o Socket.o TcpSocket.o UdpSocket.o SocketReaderWriter.o - > > lc > > > 2. Copied the compiled libcppsocket.so.1 to the directories /usr/lib > > > 3. Moved the header files to the directories /usr/include and /usr/ > > local/include > > > 4. To test the compiled library , i wrote a small program > > > #include <TcpSocket.h> > > > int main () > > { > > TcpSocket sock ; > > } > > > where TcpSocket.h is one of the header files copied to /usr/include > > > 5. Compiling this test program > > > g++ main.cpp > > /tmp/ccPqeVa9.o: In function `main': > > main.cpp:(.text+0x8a): undefined reference to `TcpSocket::TcpSocket()' > > main.cpp:(.text+0x95): undefined reference to > > `TcpSocket::~TcpSocket()' > > collect2: ld returned 1 exit status > > > gives the above error. > > > This i suppose indicates that the library has to be linked. But the > > following doesnt help > > g++ main.cpp -llibcppsocket > > > What am i missing here ? > > The linker looks only for .so and .a files ( without any version number) > Create a link libcppsocket.so -> libcppsocket.so.1.0.1.
Thanks ... _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus