Thread: Sock.h & Windows - Proglem

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    29

    Angry Sock.h & Windows - Proglem

    I can't use sock2.h & winsock2.h and some another *.h files,
    My frient told me that it's because i need to download "LIB" for C\C++ (for windows), So i start search but unsuccesfull, So anyone can send me a URL or upload them to somewhere?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    The libraries usually come with your compiler, you do not need to download them. The current MS library is called ws2_32.lib, using header winsock2.h. You need to tell your linker to use it. You don't say what compiler/IDE you are using however.

    As an aside, downloading a library for a header you have is inevitably a bad idea, there is no way you can be sure the library and the header match etc. etc. If you must, download the library AND the header at the same time from the same place with the same version numbers etc.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    29

    ...

    "You need to tell your linker to use it."
    How can i do that?
    btw - i use Visual C++

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Click Project->Settings then the Link tab, put your cursor in the edit box labelled "Object/Library modules:" then press the "End" key to get to the end of the existing list and type the library name, (ws2_32.lib), there.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    29

    I did it but...

    Compiling...
    Sock1.cpp
    c:\program files\microsoft visual studio\myprojects\sock1\sock1.cpp(3) : fatal error C1083: Cannot open include file: 'winsock32.h': No such file or directory
    Error executing cl.exe.

    Sock1.exe - 1 error(s), 0 warning(s)


    Steel, i having a problem... :\

    Here my include files:

    #include <winsock.h>
    #include <winsock32.h>
    #include <windows.h>

  6. #6
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> current MS library is called ws2_32.lib, using header winsock2.h

    ... i.e. not 32!

    You shouldn't need winsock.h, just winsock2.h.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    29

    Working!!

    It's working, i was need to #include <stdio.h>, 10x for the help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Anyone using Windows 7?
    By Sharke in forum General Discussions
    Replies: 60
    Last Post: 07-12-2009, 08:05 AM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM