| | |
wsaData : undeclared identifier
![]() |
•
•
Join Date: Jul 2003
Posts: 58
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Feb 2003
Posts: 129
Reputation:
Solved Threads: 1
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?
> 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?
This was part of a duplicate post. More information is available at http://www.daniweb.com/forums/thread1183.html
•
•
Join Date: Feb 2003
Posts: 129
Reputation:
Solved Threads: 1
I came across the following code that you posted in a different thread. Here wsaData is declared in the line I've highlighted:
Compare that with your post in this thread.
#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.
![]() |
Similar Threads
- error C2065: 'CString' : undeclared identifier (C++)
- Compile time error "undeclared identifier"for functions strcpy_s,strcat_s,_itoa_s (C++)
- Undeclared Identifier (C++)
- Class Movie...error undeclared identifier (C++)
- undeclared identifier error (C++)
- undeclared identifier error (C)
Other Threads in the C Forum
- Previous Thread: TreeListView problem
- Next Thread: Array limit
| Thread Tools | Search this Thread |
* adobe ansi api array arrays binarysearch calculate centimeter char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking hardware highest homework i/o inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pattern pdf performance pointer posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h







