Thread: Errors when including winsock2.h

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    22

    Errors when including winsock2.h

    I am relatively new to windows programming and this is my first attempt at using winsock, but this error has me baffeled.

    Using MSVC++ 6.0

    I #include "winsock2.h" but I get unresolved external symbol errors for any of the winsock functions I call. I don't get any errors for any of the structures. It's as if I am missing the definitions of the functions. (I assumed that including the header file would give access to the function definitions, since this is how the rest of my includes work)

    Also, if I move the #include "winsock2.h" to before the line #include "stdafx.h" (which MSVC put in there for me), then instead fo the linker errors, I get undeclared identifier errors for all the winsock functions instead. (not sure if this helps diagnose the problem or not)

    Any help is appreciated...

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Add the winsock2 library to the project.

    - Project/Add Existing Item/
    - Add WS2_32.lib

    Kuphryn

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    22
    Thank you VERY much, that was an extremely quick reply.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Header File Errors...
    By Junior89 in forum C++ Programming
    Replies: 5
    Last Post: 07-08-2007, 12:28 AM
  2. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 04:44 AM
  3. Sneaky little linker errors...
    By Tozar in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2006, 05:40 AM
  4. executing errors
    By s0ul2squeeze in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2002, 01:43 PM