Thread: Simple Socket Library Not so simple

  1. #1
    Registered User
    Join Date
    Nov 2005

    Simple Socket Library Not so simple

    I know that im not being very helpful with this and its not the nicest problem in the world, but I would be greatful of any help.

    Please help me, I have been looking at socket programming and found it hard to get my head around so, i thort id look at a library, i found the SIMPLE socket library at sounds like a good idea but when I try compiling the code I get this, There is no information about this that I can see on the web,plus im new to adding non standard librarys.

    testsrc # make all
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Saccept.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sprintf.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Stest.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c outofmem.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sclose.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sprtskt.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Stimeoutwait.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c rdcolor.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sgets.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sputs.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Svprintf.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c sprt.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Smaskwait.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sread.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Swait.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c srmtrblk.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Smkskt.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sreadbytes.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Swrite.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c stpblk.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sopen.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Srmsrvr.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c error.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c stpnxt.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sopenv.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sscanf.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c fopenv.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c strnxtfmt.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Speek.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c cprt.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Speername.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Speeraddr.c
    /opt/sfw/gcc-3/bin/gcc -O -I./HDR -c Sinit.c
    ar r simpleskts.a *.o
    ar: creating simpleskts.a
    finished updating simpleskts.a
    ( cd EXE; \
    make LIB=simpleskts.a CFLAGS="-O -I../HDR" LOADLIBES=../simpleskts.a EXETGT=../EXE )
    /opt/sfw/gcc-3/bin/gcc -O -I../HDR Spm.c ../simpleskts.a -o ../EXE/Spm
    Undefined first referenced
    symbol in file
    bind /var/tmp//ccVRYMI1.o
    recv ../simpleskts.a(Sgets.o)
    send ../simpleskts.a(Swrite.o)
    getsockname /var/tmp//ccVRYMI1.o
    accept ../simpleskts.a(Saccept.o)
    listen /var/tmp//ccVRYMI1.o
    gethostbyname /var/tmp//ccVRYMI1.o
    socket /var/tmp//ccVRYMI1.o
    setsockopt /var/tmp//ccVRYMI1.o
    connect ../simpleskts.a(Sopen.o)
    getpeername /var/tmp//ccVRYMI1.o
    shutdown /var/tmp//ccVRYMI1.o
    ld: fatal: Symbol referencing errors. No output written to ../EXE/Spm
    collect2: ld returned 1 exit status
    *** Error code 1
    make: Fatal error: Command failed for target `Spm'
    Current working directory /scripts/Ctuts/new/COSMIC/EXE
    *** Error code 1
    make: Fatal error: Command failed for target `exes'

    seems to work fine to start with then bombs out, can any one help
    im using solaris 9

    thanks in advance.

    Last edited by jbully; 11-04-2005 at 09:51 AM. Reason: I need help :(

  2. #2
    Bioport Productions
    Join Date
    Oct 2005
    Yea, get a new library or consult the documentation.
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:

  3. #3
    Registered User
    Join Date
    Nov 2005
    Yea, any sugrestions on what library ( where to find it ), I did read the docs on the library i have it said to compile type make all, the out put you see is the result.

  4. #4
    Join Date
    May 2004

  5. #5
    Registered User
    Join Date
    Dec 2010

    Re: Simple Socket Library Not so simple

    All those functions that you list as "undefined first reference" are Solaris-system-provided functions, not Simple Sockets Library provided functions. Apparently your system's socket functions reside in one or more libraries that isn't/aren't currently getting linked in. I don't have a Solaris system myself; however, it didn't take too much effort to use the web and find out that you need to have -lsocket -lnsl on your link line. An easy way to do that:

    export LDFLAGS="-lsocket -lnsl"

    will (probably) do the trick. (looked at A Crash Course in UNIX TCP/IP Socket Programming)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with simple socket client/server program
    By spencer88 in forum C Programming
    Replies: 6
    Last Post: 05-06-2009, 12:05 AM
  2. Replies: 12
    Last Post: 02-10-2009, 02:14 PM
  3. Need help with audio library on DOS...
    By Marton79 in forum C Programming
    Replies: 10
    Last Post: 08-25-2006, 01:32 AM
  4. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 12:48 PM
  5. Linker errors with simple static library
    By Dang in forum Windows Programming
    Replies: 5
    Last Post: 09-08-2001, 10:38 AM
Website Security Test