Forward declaration with g++

This is a discussion on Forward declaration with g++ within the C++ Programming forums, part of the General Programming Boards category; In class filter.h, I have the following forward declarations template<class T> //Forward declaration due to circular dependency class Agc; class ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Forward declaration with g++

    In class filter.h, I have the following forward declarations

    template<class T> //Forward declaration due to circular dependency
    class Agc;
    class FixPt;
    class QuantizerCmplx;
    template<class T>
    class Quantizer;

    I get the following errors while compiling with g++.

    ../source/filter.h: In member function ‚int FarrowFilter<T>::filter_quantize()‚:
    ../source/filter.h:1837: error: invalid use of undefined type ‚struct QuantizerCmplx‚
    ../source/filter.h:12: error: forward declaration of ‚struct QuantizerCmplx‚

    How do I solve this problem? It compiles fine with VC++

    Thanks

  2. #2
    Student legit's Avatar
    Join Date
    Aug 2008
    Location
    UK -> Newcastle
    Posts
    156
    Please use code tags. It makes your post so much easier to read.
    Last edited by legit; 06-15-2009 at 09:48 AM.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    Lemme guess, rather than insert [code][/code] tags, you decided to do the bone-headed thing and remove all the braces instead, just to stop the board complaining at you.

    Great, now what you posted it utterly meaningless.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    It basically says that there is something on line 1837 that requires the full definition of QuantizerCmplx for which a forward declaration alone is not enough.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  5. #5
    Kung Fu Kitty Angus's Avatar
    Join Date
    Oct 2008
    Location
    Montreal, Canada
    Posts
    115
    The last time I tried to forward declare a template class I failed. I'll bet it has something to do w/that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 03:35 PM
  2. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  3. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  4. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21