Qt(Creator)with WinSocks(ws2_32) [英] Qt (Creator) with WinSocks (ws2_32)

查看:185
本文介绍了Qt(Creator)with WinSocks(ws2_32)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Qt项目中使用旧的代码片段,它使用WinSocks。

我使用Qt Creator创建了我的程序,我不知道,我如何链接到ws2_32-Library。我已经添加 LIBS + = -lws2_32 到我的.pro,但什么也没有发生。那么如何链接到此库?

I want to use an older code-fragment in my Qt-project, which is using WinSocks.
I created my program with Qt Creator and I don't know, how I can link to the ws2_32-Library. I already added LIBS += -lws2_32 to my .pro, but nothing happened. So how can I link to this library?

编辑:在哪里可以找到ws2_32.lib包含它?我必须先下载吗?我知道它与Visual Studio,但我不使用它,我不想使用它。

edit: Where can I find the ws2_32.lib to include it? Do I have to download it first? I know it comes with "Visual Studio", but I don't use it and I don't want to use it.

推荐答案

p> ok,当你知道它,它真的很简单。Qt-SDK附带一个WinSock2库,叫 libws2_32.a 。你只有
do,is is enter this line in your .pro:

ok, when you know it, it's really simple.The Qt-SDK comes with a WinSock2-Library, called libws2_32.a.The only thing you have to do, is to enter this line in your .pro:


LIBS + = C:\Qt \2009.04\mingw\lib\libws2_32.a

这包括winsock2库

this includes the winsock2-library to your project and you have nothing else to do.

您可以通过在.pro中使用此行来稍微简单一些:

You may do this slightly more simply by using this line in your .pro:

LIBS += -lws2_32

这篇关于Qt(Creator)with WinSocks(ws2_32)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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