错误信息:
undefined reference to`_imp___ZN10QTcpSocketD1Ev'
undefined reference to `_imp___ZN10QTcpSocketC1EP7QObject'
undefined reference to `_imp___ZN10QTcpSocketD1Ev'
undefined reference to `_imp___ZN10QTcpSocketD1Ev'
undefined reference to `_imp___ZN10QTcpSocketD1Ev'
undefined reference to `_imp___ZN10QTcpSocketD1Ev'
undefined reference to `_imp___ZN10QTcpSocketD1Ev'
undefined reference to`_imp___ZN15QAbstractSocket13connectToHostERK7QStringt6QFlagsIN9QIODevice12OpenModeFlagEE'
undefined reference to `_imp___ZN15QAbstractSocket5closeEv'
collect2: ld returned 1 exit status
解决方案:
链接库问题,在工程文件(.pro)文件中
QT += core gui network
加上network选项