943,293 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 16322
  • C RSS
Sep 28th, 2003
0

wsaData : undeclared identifier

Expand Post »
i get a error that i cant figure out any help?

void main()
{
// Initialize WinSock
int wsaret=WSAStartup(0x101,&wsaData);
if(wsaret)
return;
//Create the SOCKET

SOCKET conn;
conn=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(conn==INVALID_SOCKET)
return;

//clean up mess
closesocket(conn);
WSACleanup();
}

i get this error:

wsaData : undeclared identifier

any help
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
fakespike is offline Offline
58 posts
since Jul 2003
Oct 4th, 2003
0

Re: wsaData : undeclared identifier

Hard to say exactly, as you don't appear to have posted the complete compileable code that exhibits your problem.

> void main()
>{
>// Initialize WinSock
> int wsaret=WSAStartup(0x101,&wsaData);

You use wsaData in the line above. Where is it declared? Is it somewhere before main() is called, or does it exist in a header file somewhere that is (or is supposed to be) included by your program?
Bob
Team Colleague
Reputation Points: 15
Solved Threads: 2
Junior Poster
Bob is offline Offline
129 posts
since Feb 2003
Oct 4th, 2003
0

Re: wsaData : undeclared identifier

This was part of a duplicate post. More information is available at http://www.daniweb.com/forums/showthread.php?t=1183
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Oct 4th, 2003
0

Re: wsaData : undeclared identifier

I came across the following code that you posted in a different thread. Here wsaData is declared in the line I've highlighted:
#include <winsock.h>
#include <wsipx.h>
#include <wsnwlink.h>
#include <stdio.h>

int main()
{
////////////////
// Initialize windows sockets API.
//
WORD wVersionRequested = MAKEWORD(1, 1);
WSADATA wsaData;
if (WSAStartup(wVersionRequested, &wsaData)) {

Compare that with your post in this thread.
Bob
Team Colleague
Reputation Points: 15
Solved Threads: 2
Junior Poster
Bob is offline Offline
129 posts
since Feb 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: TreeListView problem
Next Thread in C Forum Timeline: Array limit





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC