Cygwin/gcc Incompatibility With Winsock2.h

This is a discussion on Cygwin/gcc Incompatibility With Winsock2.h within the Networking/Device Communication forums, part of the General Programming Boards category; I'm running the latest cygwin release on Windows 2000 and am getting ridiculous errors, which make absolutely no sense to ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    54

    Cygwin/gcc Incompatibility With Winsock2.h

    I'm running the latest cygwin release on Windows 2000 and am getting ridiculous errors, which make absolutely no sense to me, as I'm including the header files that the installation provided. Whats with this??

    undefined reference to `_send@16'
    undefined reference to `_recv@16'
    undefined reference to `_closesocket@4'
    undefined reference to `_recv@16'
    undefined reference to `_send@16'
    undefined reference to `_recv@16'
    undefined reference to `_send@16'
    undefined reference to `_recv@16'
    undefined reference to `_recv@16'
    undefined reference to `_send@16'
    undefined reference to `_recv@16'
    undefined reference to `_setsockopt@20'
    undefined reference to `_recv@16'
    undefined reference to `_WSAGetLastError@0'
    undefined reference to `_setsockopt@20'
    undefined reference to `_WSAGetLastError@0'
    undefined reference to `_send@16'
    undefined reference to `_itoa'

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    54
    If anyone has ever used gcc and winsock2, can you help me with this situation? What is going on with this, gcc gives very little documentation on winsock2 stuff. FYI the functions are definited in the winsock2.h file in the directory containing my gcc installation.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,751
    Well you still need to specify which libraries you want to link with.

    Something like
    Code:
    gcc prog.c -lsocket
    would compile your prog.c, then link with libsocket.a

    Now the actual name(s) of the libraries you'd need to link with would require a bit more research (I don't know them off hand), but you should find a long list of them in /usr/lib within cygwin.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-04-2009, 02:57 PM
  2. winsock2.h problem
    By xixpsychoxix in forum Networking/Device Communication
    Replies: 1
    Last Post: 10-08-2008, 06:08 PM
  3. Winsock.h and Winsock2.h
    By azteched in forum Networking/Device Communication
    Replies: 5
    Last Post: 12-24-2004, 07:42 PM
  4. Errors when including winsock2.h
    By skiingwiz in forum Windows Programming
    Replies: 2
    Last Post: 12-27-2002, 07:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21