加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

关于qt :: error: collect2: ld returned 1 exit status的解决方案

(2010-10-31 20:15:34)
标签:

qt学习总结

it

分类: QT学习之路
关于qt :: error: collect2: ld returned 1 exit status的解决方案

今天在调QJson库的时候,遇到一个问题。
编译的时候会遇到:qt :: error: collect2: ld returned 1 exit status这个错误
在网上搜索也有很多朋友遇到了这个问题,但是没有搜索到解决办法。

QT真的很棒,甚至大家在DEBUG中遇到的问题QT都希望改善一下。
大家看看QTest头文件。看看里面给大家提供了多少调试用的宏
摘取二个经常用到的宏
QVERIFY
//看看Assistant的官方解释
The QVERIFY() macro checks whether the condition is true or not. If it is true, execution continues. If not, a failure is

recorded in the test log and the test won't be executed further.
QCOMPARE
The QCOMPARE macro compares an actual value to an expected value using the equals operator. If actual and expected are identical,

execution continues. If not, a failure is recorded in the test log and the test won't be executed further.
因为QT太灵活了,有些时候解析得到的数据没有办法很好的输出。
那么怎么办,那就不输出。直接写死几个数据,用这些宏去比较。真的比较方便的说。

呃,是不是跑题了。说了半天没有说重点怎么解决上面的BUG。
呵呵,很简单。
在PRO文件中添加//testlib即可
QT       += testlib

相当的郁闷吧。嘎嘎!!

本文由Mark15021@devdiv.net原创!
转载需注明出处!!

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有