`
onmyway_1985
  • 浏览: 32650 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

qt编译multiple definition of错误

 
阅读更多

学习QT编程,编译时出现multiple definition of错误,

  4 people::people()
  5 {
  6     connect(this, SIGNAL(sig1()), this, SLOT(slo1()));
  7 }
  8
  9 people::~people()
 10 {}
 11 /*
 12 void people::sig1()
 13 {                                                                          
 14     printf("in sig.\n");
 15 }
 16 */
 17 void people::slo1()
 18 {
 19     printf("in slo.\n");
 20 }

原来,QT预处理工具会将people.cpp中宏展开为moc_people.cpp,moc_people.cpp中包含了

101 void people::sig1()
102 {
103     printf("in sig1.\n");
104     QMetaObject::activate(this, &staticMetaObject, 0, 0);
105 }

 

具体宏是怎么处理的,下面继续学习。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics