Winsock Problems

This is a discussion on Winsock Problems within the C++ Programming forums, part of the General Programming Boards category; Hi all, I'm pretty new to the forums and all things C related, but hopefully someone can help me out ...

  1. #1
    Might Pirate
    Join Date
    Jun 2005
    Posts
    6

    Winsock Problems

    Hi all,

    I'm pretty new to the forums and all things C related, but hopefully someone can help me out as im at a lost end.

    I've been picking up some C++ the past few weeks and have already encountered many a problem, but non that i couldn't sort out with a little bit of brain power and elbow grease. Now i find that when i compile a small snippet of glorious code, im recieve the error...

    "fatal error C1083: Cannot open include file: 'winsock.h': No such file or directory"

    I also recieve the same error in a similar program but instead the error informs me that "windows.h" is missing too.

    Now, ive searched my hard drive high and low, ive googled it, investigated my fiance's computer and have finally ground to a hault after many failed attempts for the elusive files.

    Call me crazy, but shouldnt these files be included with MSVC?

    Im running windows 2000, MSVC and the Directx 9 SDK. - Please can anyone help? where can i find the files to include?

    A link or a friendly email would be very much appreciated, thanks for reading all

    Zachy!

  2. #2
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    I believe that winsock.h is deprecated to something like wsock32.h or something like that. Deprecated means it can be dropped from future releases with no notification. I expect you are trying to compile some old code, either look for a more modern source or post some code here (be sure to use "code" tags!) and we can help you.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  3. #3
    Might Pirate
    Join Date
    Jun 2005
    Posts
    6
    Hi, the code i have so far is:

    Code:
    #include "stdafx.h"
    #include <stdio.h>
    #include <mysql++.h>
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	return 0;
    }
    and the error msg is in my previous post.

    I was thinking that maybe the mySQL++.h and other associated files may be refering to and older version of winsock.h - but after searching high and low... the only file i can find on my hard drive is "winsock.dll"

  4. #4
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    I suggest a mysql forum is probably a better bet than a general C++ forum.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  5. #5
    Might Pirate
    Join Date
    Jun 2005
    Posts
    6
    As far as i can tell tho, its not the mysql thats a problem.

    everything would be ok if i could tell why its lookin for winsock.h when it doesnt exist. the SQL parts will probably work fine once i can get past the compiler error.

    how can i sort out the winsock reference?

    #include <winsock.dll>

    ?

  6. #6
    Might Pirate
    Join Date
    Jun 2005
    Posts
    6
    why reference a file that doesnt exist? - its just plain daft.

    is there a way to obtain this file from somewhere? maybe someone could post it to download?

    Or is there an alternative to using winsock? Surely it would be included in the MSVC setup files?

  7. #7
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    You are not including winsock, something else is doing so. There is a pretty decent chance you are using old headers from an old installation and you should probably upgrade. Fixing this (presuming you even manage) is only likely to get you to yet another problem and you get to start all over again. You can continue to waste time and energy on this or you can try some of my suggestions, it is up to you.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  8. #8
    Might Pirate
    Join Date
    Jun 2005
    Posts
    6
    Sorry for my ignorance, but i assumed when i downlaoded the latest version of mySQL++ it would include the files i need to compile and run etc.

    Already, ive remvoed the said files nad am searching again for an update or patch of some kind but i doubt it will make any difference as the two versions ive tried prior to this have caused me the same problems.

    Thanks for your time.

  9. #9
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    winsock headers are not likely to be part of the mySQL distribution as they are considered part of the standard compiler distribution. I think you should find a mySQL forum and ask there, it is probably a common issue.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  10. #10
    Might Pirate
    Join Date
    Jun 2005
    Posts
    6
    I've looked on many sql forums and sites and no one seems to ecounter this problem. Many people have winsock problems but mainly due to the macro's etc.. not the actual location of the file.

    I assumed that winsock.h would come with either MSVC or the mySQL++ but it seems thats not the case.

    Also, afer downloading another version of mySQL++ the problem is still the same, so it looks as though no matter what i do... it seems very bleak that ill actually resolve the problem.

    Im really not sure where to go from here, ill post on a few other forums and see if anyone has any ideas, but other than that... i think ill call it quits for the day.

    Thanks again.

  11. #11
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    try #include <winsock2.h> instead

  12. #12
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    xErath, he is having problems with a header embedded in a distributed application, altering the header is not likely to be a good solution.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. winsock linking problems
    By Calef13 in forum Windows Programming
    Replies: 2
    Last Post: 08-29-2007, 09:54 AM
  2. winsock problems
    By axr0284 in forum C++ Programming
    Replies: 5
    Last Post: 03-22-2006, 09:40 AM
  3. Huge problems in Winsock recv!
    By sirSolarius in forum Networking/Device Communication
    Replies: 0
    Last Post: 09-11-2004, 10:34 AM
  4. Winsock - Asynchrnonous Server problems
    By neandrake in forum Windows Programming
    Replies: 6
    Last Post: 06-24-2003, 07:19 PM
  5. Complete Port I/O and Heap Problems :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 11-05-2002, 12:45 AM

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