Results 1 to 4 of 4

Thread: Is there a circular reference here?

  1. #1
    Join Date
    Jan 2006
    Location
    Winnipeg, MB. Canada
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Is there a circular reference here?

    I have exempted actual code for the sake of simplification, so this is basically how it goes:

    I have these files:

    BaseDecoder.h
    YDecoder.h
    Decoder.h
    Decoder.cpp

    BaseDecoder.h declares an abstract BaseDecoder class.

    YDecoder.h declares a YDecoder class derrived from BaseDecoder and includes BaseDecoder.h.

    Decoder.h declares a Decoder class (not inherited from anything) which contains a member of type BaseDecoder (and other misc. methods), and includes BaseDecoder.h.

    Decoder.cpp implements Decoder class member methods such as getFileName and setDecoder and includes Decoder.h and YDecoder.h.

    The error that i'm getting is:
    cannot declare member function `Decoder::getFileName' within `YDecoder'

    getFileName is declared in Decoder.h, not in YDecoder, yet gcc somehow thinks it is.

    I've tried some forward declarations of the BaseDecoder class in Decoder.h and YDecoder.h, but that just creates different errors.

    Thanks to any suggestions.
    Plan? There ain't no plan!

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Is there a circular reference here?

    We need source.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is there a circular reference here?

    Quote Originally Posted by rh
    The error that i'm getting is:
    cannot declare member function `Decoder::getFileName' within `YDecoder'
    In which file and which line does this error occur? Check if you have semicolons after all class definitions.

  4. #4
    Join Date
    Jan 2006
    Location
    Winnipeg, MB. Canada
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is there a circular reference here?

    @jacek:

    Good suggestion. It was actually an implementation detail i was going to put in the header, but changed my mind and inadvertently left an opening brace.

    It threw me off because the error for that only appears later down in the output window. As probably most people do, i only pay attention to the first errors listed since they typically cause whatever else is broken down the line.

    Thanks again.
    Plan? There ain't no plan!

Similar Threads

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

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.