-
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!
-
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.
-
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"
-
I suggest a mysql forum is probably a better bet than a general C++ forum.
-
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>
?
-
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?
-
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.
-
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.
-
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.
-
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.
-
try #include <winsock2.h> instead
-
xErath, he is having problems with a header embedded in a distributed application, altering the header is not likely to be a good solution.