This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

HELP: How to link with Winsock2 library?


  I am a green hand at cygwin programming.
  I tried to compile a winsock program but I kept get
linking errors. I reduced the program to the simplest
form, as below:

#include <windows.h>
#include <winsock2.h>

void main(){
SOCKET socket;
closesocket(socket);
}

When I tried to compile it with
g++ -o main -lws2_32 main.cpp
I got error message:
/cygdrive/c/TEMP/cc8N0jmo.o(.text+0x13):main.c:
undefined reference to `closesocket@4'

Could you help me?  Thank you very much.

Yue Luo

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]