Thread: UnKnown winsock error when compiling...

  1. #1
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154

    Question UnKnown winsock error when compiling...

    Hi, I new to network programming, and am starting off by making a console chat program. When I try and compile, it comes up with this error, and I don't understand whats going wrong. It happens when I try to initalize winsock, there is a small extract of my code if that helps...

    Code:
    WSADATA WsaDat;
    if (WSAStartup(MAKEWORD(1, 1), &WsaDat) != 0)
               {
                printf("WSA Initialization failed.");
               }
    And here is the error...
    Code:
    "Test.exe" -L"C:/Program Files/Dev-Cpp/lib"  
    test.o(.text+0x7a8):test.cpp: undefined reference to `WSAStartup@8'
    make.exe: *** [Test.exe] Error 1


  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    You need to link to the winsock library. I believe the library file is libws2_32.a

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown error compiling .. plz help!
    By dezz101 in forum C Programming
    Replies: 3
    Last Post: 05-25-2008, 08:31 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM
  5. Unknown Compiling Error
    By Darkflame in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2001, 01:35 PM