C ++ winsock服务器编程 [英] C ++ winsock server programming

查看:99
本文介绍了C ++ winsock服务器编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决这个错误?

使用g ++编译器



C:\ Users \Chan \Desktop\f ***。cpp:在函数'int main()'中:

C:\ Users \Chan \Desktop\f ***。cpp:47:62:错误:' getaddrinfo'未在此范围内声明

C:\ Users \Chan \Desktop\f ***。cpp:58:28:错误:'freeaddrinfo'未在此声明范围

C:\ Users \Chan \Desktop\f ***。cpp:67:28:错误:'freeaddrinfo'未在此范围内声明

C:\ Users \Chan \Desktop\f ***。cpp:73:24:错误:'freeaddrinfo'未在此范围内声明

解决方案

包含头文件 Ws2tcpip.h 。它位于Windows SDK的include目录中。


请参阅 http:// linux.die.net/man/3/getaddrinfo [ ^ ]。

How to solve this error?
Using g++ compiler

C:\Users\Chan\Desktop\f***.cpp: In function 'int main()':
C:\Users\Chan\Desktop\f***.cpp:47:62: error: 'getaddrinfo' was not declared in this scope
C:\Users\Chan\Desktop\f***.cpp:58:28: error: 'freeaddrinfo' was not declared in this scope
C:\Users\Chan\Desktop\f***.cpp:67:28: error: 'freeaddrinfo' was not declared in this scope
C:\Users\Chan\Desktop\f***.cpp:73:24: error: 'freeaddrinfo' was not declared in this scope

解决方案

Include the header file Ws2tcpip.h. It is located in the include directory of the Windows SDK.


See http://linux.die.net/man/3/getaddrinfo[^].


这篇关于C ++ winsock服务器编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆