You are not logged in.

1

Wednesday, June 27th 2012, 5:25pm

linker error during signal declaration



  1. inside a.h


  2. #include "b.h"


  3. class A:public QObject


  4. {


  5. Q_OBJECT


  6. public:


  7. A();


  8. public:


  9. B *b;


  10. slot:


  11. A* retobj();


  12. };


  13. inside a.cpp


  14. A::A()


  15. {


  16. b= new B();


  17. QObject::connect(b,SIGNAL(returnObj(),this,SLOT(retobj()));





  18. }


  19. A * A::retobj()


  20. {


  21. return this ;


  22. }


  23. //----------------


  24. inside b.h





  25. class A; //forward declaration


  26. class B:public QObject


  27. {


  28. Q_OBJECT


  29. public:


  30. B();


  31. A *a1;


  32. public:


  33. void hello();


  34. signal:


  35. A* returnObj();


  36. };


  37. //------------------


  38. inside b.cpp


  39. B::B()


  40. {





  41. }


  42. void B::hello()


  43. {


  44. a1= emit returnObj();


  45. }


  46. //------------------


  47. inside main





  48. #include "a.h"


  49. #include"b.h"


  50. int main()


  51. {


  52. A * a2= new A();


  53. B * b2=new B();


  54. b->hello();


  55. }


  56. //-------------------------

The above code is compiling but during linking its showing some problem ..something like unresolved external symbol returnObj();
What might be the reason ..
Thankx in adv ..

2

Wednesday, June 27th 2012, 5:41pm

JHC what is this I dont even...

do you seriously think anyone will read that?
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar threads

Used tags

Qt4