qt程序运行时的错误error:undefined reference to `_imp___ZN10QTcpSocketD1Ev'

时间:2022-06-06 10:10:24
出现的错误:
  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 += network