Menu

Linker error on socket function

Anonymous
2002-11-09
2012-09-26
  • Anonymous

    Anonymous - 2002-11-09

    Hello,

    I'm a problem when I compile a simple program with socket function like "send", "recv", "AccepteClients", "socket", "closesocket"... in Windows.
    I have included <windows.h>, <winsock.h> and all other header files required by the various functions, but this is the output of compiler:

    undefined reference to `WSAStartup@8'
    undefined reference to `socket@12'
    undefined reference to `htons@4'
    undefined reference to `bind@12'
    undefined reference to `closesocket@4'
    undefined reference to `listen@8'
    undefined reference to `accept@12'
    undefined reference to `send@16'
    undefined reference to `recv@16'
    undefined reference to `gethostbyaddr@12'
    undefined reference to `inet_ntoa@4'

    Then, which it could be the problem?

    Tanks!

     
    • Nobody/Anonymous

      project->project options
      in the box saying something like "other linker options" type:
      "-lwsock32"

       
    • Anonymous

      Anonymous - 2002-11-09

      Thanks !!!
      I'm very happy !!!!
      It's good now !!!
      Thanks !!!!!!!!!!!!!!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.