• 4672阅读
  • 1回复

请教QT4.5.0forx11中的network问题 [复制链接]

上一主题 下一主题
离线haoyew
 

只看楼主 倒序阅读 楼主  发表于: 2010-03-04
QT新手请教:
环境:Ubuntu 8.10
QT版本:qt-x11-opensource-src-4.5.0
问题:
    程序使用的是example中的network-chat,设置好QTDIR、PATH、LD_LIBRARY_PATH后,qmake,make。
编译报错:
client.h:45:27: error: QAbstractSocket: 没有该文件或目录
client.h:47:24: error: QHostAddress: 没有该文件或目录
In file included from client.h:49,
                 from chatdialog.h:46,
                 from chatdialog.cpp:44:
server.h:45:22: error: QTcpServer: 没有该文件或目录
检查Makefile,发现INCPATH中没有加入QtNetwork目录。
添加该目录后,再make,还是有错,
错误为:
client.cpp:(.text+0x96): undefined reference to `QHostAddress::operator==(QHostAddress const&) const'
client.cpp:(.text+0xe6): undefined reference to `QAbstractSocket::peerPort() const'
client.o: In function `Client::Client()':
client.cpp:(.text+0x347): undefined reference to `QTcpServer::serverPort() const'
client.cpp:(.text+0x409): undefined reference to `QTcpServer::~QTcpServer()'
client.o: In function `Client::Client()':
client.cpp:(.text+0x487): undefined reference to `QTcpServer::serverPort() const'
client.cpp:(.text+0x549): undefined reference to `QTcpServer::~QTcpServer()'
这一次就不知道怎么办了,还请大家帮助。
PS:
该程序如果使用qt-embedded-4.5.0进行编译,毫无问题。
离线haoyew

只看该作者 1楼 发表于: 2010-03-04
看到别的帖子里有回答:pro里加QT += network。
查看qt帮助中network,果然有这样一段话,要求自行加上该命令。
试了一下,程序可以编译并执行。
但是,还是不能理解,如果说必须pro里加QT += network的话,为何qt-embedded可以正确编译呢?
快速回复
限100 字节
 
上一个 下一个