winsocket 问题
用VC编写winsock网络程序需要加载其他库吗?为什么我把书中老师说是完整的代码运行后出现很多错?
'CInitSock' : missing storage-class or type specifiers
D:\数据结构作业\win2\win2.cpp(6) : error C2501: 'initSock' : missing storage-class or type specifiers
D:\数据结构作业\win2\win2.cpp(12) : error C2065: 'printf' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(17) : error C2065: 'socketaddr_in' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(17) : error C2146: syntax error : missing ';' before identifier 'sin'
D:\数据结构作业\win2\win2.cpp(17) : error C2065: 'sin' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(18) : error C2228: left of '.sin_family' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(19) : error C2228: left of '.sin_port' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(19) : error C2065: 'hosn' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(20) : error C2228: left of '.sin_addr' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(20) : error C2228: left of '.S_un' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(20) : error C2228: left of '.S_addr' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(20) : error C2065: 'INAADDR_ANY' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(21) : error C2065: 'slisten' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(21) : error C2065: 'LPSOCKEADDR' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(26) : error C2065: 'sListen2' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(32) : error C2065: 'socket_in' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(32) : error C2146: syntax error : missing ';' before identifier 'renmoteAddr'
D:\数据结构作业\win2\win2.cpp(32) : error C2065: 'renmoteAddr' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(33) : error C2065: 'remoteAddr' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(38) : error C2065: 'sClient' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(38) : error C2065: 'SOCKEADDR' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(38) : error C2059: syntax error : ')'
D:\数据结构作业\win2\win2.cpp(39) : error C2065: 'sLient' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(44) : error C2228: left of '.sin_addr' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(53) : error C2084: function 'int __cdecl main(void)' already has a body
D:\数据结构作业\win2\win2.cpp(55) : error C2065: 's' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(61) : error C2146: syntax error : missing ';' before identifier 'servAddr'
D:\数据结构作业\win2\win2.cpp(61) : error C2065: 'servAddr' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(62) : error C2065: 'serv' : undeclared identifier
D:\数据结构作业\win2\win2.cpp(62) : error C2228: left of '.sin_family' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(63) : error C2228: left of '.sin_port' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(64) : error C2228: left of '.sin_addr' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(64) : error C2228: left of '.S_un' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(64) : error C2228: left of '.S_addr' must have class/struct/union type
D:\数据结构作业\win2\win2.cpp(72) : error C2078: too many initializers
执行 cl.exe 时出错.
win2.exe - 1 error(s), 0 warning(s)