找不到 Netinet 和 netdb,C++ 网络库 [英] Netinet and netdb not found, c++ network libraries

查看:107
本文介绍了找不到 Netinet 和 netdb,C++ 网络库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过以下链接运行示例代码,以了解如何在 c++ 上使用 winsock:http://www.linuxhowtos.org/data/6/client.chttp://www.linuxhowtos.org/data/6/server.c

I was trying to run example codes to learn how to use winsock on c++ from the following links: http://www.linuxhowtos.org/data/6/client.c http://www.linuxhowtos.org/data/6/server.c

以及以下库:

#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h> 

不在默认的 mingw 库中,并且通过尝试 google 并没有取得多大成功,因为它最终需要其他库才能运行.

was not at the default mingw libraries, and by trying to google it wasn't much of a success because it end up requiring other libraries to run.

如果有人有完整库或带有依赖项的链接,我将不胜感激.

if anyone have a link to the full library or it with the dependencies, i would appreciate it.

提前致谢.

推荐答案

我删除了 netinet/in.h 和 netdb.h 库,添加并添加了链接:-lwsock32",现在一切正常.

I removed both netinet/in.h and netdb.h library, added and added the link: "-lwsock32", all working now.

这篇关于找不到 Netinet 和 netdb,C++ 网络库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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