QT编译的问题- invalid use of incomplete type...

  刚开始学QT,在编写TCP、UART的时候,两次遇到了这样的编译错误,以TCP为例:
 
      

invalid use of incomplete type 'struct QHostAddress'

forward declaration of 'struct QHostAddress'

网上有很多人遇到过这样的编译错误,如这位朋友的文章:http://icivelee.blog.163.com/blog/static/147198932201171025810737/
有人说这是版本的原因,但我没有深究。我的错误最终解决办法是加上这样一句话:
 
      

#include <QHostAddress>

网上有个朋友说: Such an error message in Qt usually means that you have to  #include ,实乃高见。

你可能感兴趣的:(QT)