Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26

Thread: Undefined Reference error!!!

  1. #21
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Undefined Reference error!!!

    Hi...

    The new class which i have created is CanvasMouse..

    Now in my ImageZoomer i have created a CanvasMouse *canmouse variable which would call the CanvasMouse which inherits the Q3CanvasView....

    In imageZoomer i have created a Q3CanvasView and have passed in the constructor of the CanvasMouse which reads this
    CanvasMouse(Q3CanvasView *canview): canvasview(canview)

    Now class CanvasMouse contains all the canvas related functionalities...

    is this approach correct ?????

  2. #22
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Undefined Reference error!!!

    Quote Originally Posted by Kapil
    In imageZoomer i have created a Q3CanvasView and have passed in the constructor of the CanvasMouse which reads this
    CanvasMouse(Q3CanvasView *canview): canvasview(canview)
    You sholdn't give Q3CanvasView parametr. You need give only pointer on parent class.

    Qt Code:
    1. CanvasMouse *canmous = new CanvasMouse(this);
    2.  
    3. *****
    4. CanvasMouse(ImageZoomer*p): canvasview(p)
    5. {
    6. }
    To copy to clipboard, switch view to plain text mode 


    p.s. also you could give any parametres (if you dont need it in future )
    a life without programming is like an empty bottle

  3. #23
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Undefined Reference error!!!

    Quote Originally Posted by zlatko
    You sholdn't give Q3CanvasView parametr. You need give only pointer on parent class.

    Qt Code:
    1. CanvasMouse *canmous = new CanvasMouse(this);
    2. *****
    3. CanvasMouse(ImageZoomer*p): canvasview(p)
    4. {
    5. }
    To copy to clipboard, switch view to plain text mode 
    Hi..

    won't this result in a circular dependency... i have included the header file "canmouse.h" in my ImageZoomer class and created an object of it.. Now when i pass the ImageZoomer object to CanMouse class, it would i suppose result into a circular dependency...

    Isn't it so?????

  4. #24
    Join Date
    Mar 2006
    Posts
    10
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Undefined Reference error!!!

    yes, there is no need to pass the imagezoomer to your canvas, no need at all...
    just have the canvas as member of imagezoomer and add this to one of your layouts

  5. #25
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Undefined Reference error!!!

    Quote Originally Posted by incubator
    yes, there is no need to pass the imagezoomer to your canvas, no need at all...
    just have the canvas as member of imagezoomer and add this to one of your layouts
    Hi...

    i have done something similar but getting error
    "Undefined reference to VTABLE" error.. I know this is inheritance problem but am not able to understand where i have gone wrong..

    i have created a main.cpp where i create MainWindow object and pass it to ImageZoomer.cpp...
    Now in ImageZoomer.cpp i have created CanvasMouse object and passed it the frame where i have to set the Canvas...
    CanvasMouse derives the base class Q3CanvasView and in the constructor i have intialized the Q3CanvasView to frame.. The statement is:

    CanvasMouse::CanvasMouse(QFrame *frame): Q3CanvasView(frame){}


    But it is creating error.. what can be the possible reason behind it...

  6. #26
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Undefined Reference error!!!

    Hi..

    Done....

    Thanks a lot everyone for all the suggestions provided....

    Kapil

Similar Threads

  1. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  2. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 13:41
  3. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  4. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15
  5. Strange error while using Q3Canvas
    By Kapil in forum Newbie
    Replies: 13
    Last Post: 15th June 2006, 19:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.