compilation Problems in jwSMTP code-1.32.13

2006-11-29
2013-04-08
  • Hi ,

    Thanks for providing this Source code, its very much help full for me to use this one in my application, but while compiling this code i am getting the following errors

    //////////////////////////

    jwsmtp/.libs/libjwsmtp.a(mailer.o)(.text+0xf530):C:/msys/1.0/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/basic_string.h:1452: undefined reference to `gethostbyname@4'
    jwsmtp/.libs/libjwsmtp.a(mailer.o)(.text+0xf6de): In function `ZN6jwsmtp6mailerclEv':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.h:121: undefined reference to `gethostbyaddr@12'
    jwsmtp/.libs/libjwsmtp.a(mailer.o)(.text+0xf981): In function `ZN6jwsmtp6mailerclEv':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/mailer.cpp:432: undefined reference to `gethostname@8'
    jwsmtp/.libs/libjwsmtp.a(compat.o)(.text+0x1d): In function `ZN6jwsmtp7ConnectEjRKNS_11SOCKADDR_INE':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.h:120: undefined reference to `connect@12'
    jwsmtp/.libs/libjwsmtp.a(compat.o)(.text+0x4c): In function `ZN6jwsmtp6SocketERjiii':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.cpp:36: undefined reference to `socket@12'
    jwsmtp/.libs/libjwsmtp.a(compat.o)(.text+0x92): In function `ZN6jwsmtp4SendERijPKcji':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.cpp:45: undefined reference to `send@16'
    jwsmtp/.libs/libjwsmtp.a(compat.o)(.text+0xd2): In function `ZN6jwsmtp4RecvERijPcji':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.cpp:54: undefined reference to `recv@16'
    jwsmtp/.libs/libjwsmtp.a(compat.o)(.text+0xff): In function `ZN6jwsmtp11ClosesocketERKj':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.cpp:66: undefined reference to `closesocket@4'
    jwsmtp/.libs/libjwsmtp.a(compat.o)(.text+0x15d): In function `ZN6jwsmtp14initNetworkingEv':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.cpp:85: undefined reference to `WSAStartup@8'
    jwsmtp/.libs/libjwsmtp.a(compat.o)(.text+0x122): In function `_tcf_0':
    c:/temp/jwsmtp-1.32.13/jwsmtp/jwsmtp/compat.cpp:99: undefined reference to `WSACleanup@0'
    collect2: ld returned 1 exit status
    make[3]: *** [demo1.exe] Error 1
    make[3]: Leaving directory `/c/temp/jwsmtp-1.32.13/jwsmtp'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/c/temp/jwsmtp-1.32.13/jwsmtp'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/c/temp/jwsmtp-1.32.13'
    make: *** [all] Error 2

    /////////////////////////

    can any body suggest me the solution for this

    Thx
    sridhar
    pinisettisridhar@yahoo.com

     
    • John Wiggins
      John Wiggins
      2007-01-22

      Looks like you are not linking against the ws2_32.lib (windows library for sockets).
      This should be handedled by the pragma in compat.h in VC other compilers will ignore so they must be told explicitly about the library.