Incomplete type

This is a discussion on Incomplete type within the C++ Programming forums, part of the General Programming Boards category; Hi everyone, When I'm using gdb to debug I ask for it to print a variable for me. It sometimes ...

  1. #1
    Registered User nepper271's Avatar
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    50

    Incomplete type

    Hi everyone,

    When I'm using gdb to debug I ask for it to print a variable for me. It sometimes (many) responds '<incomplete type>'. What does it mean? And why is it there?

    The variable I'm trying to print is a derived class, it is located inside a template function, although I have find the same behaviour in other functions.

    Thank you very much for your help,
    Nepper271.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    It probably means that gdb can't find full debugging information for the object's type.

    Can you produce a minimal test case? A project setup where the problem occurs?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User nepper271's Avatar
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    50
    I don't think i can make a smaller program right now, but the problem appears real early as I was seeing now. My classes are something like:

    Code:
    class MATRIX {
      public:
        MATRIX(int m, int n);
        ...
    };
    
    class VECTOR : public MATRIX {
      public:
        VECTOR(int n) : MATRIX(n, 1) { };
        ...
    };
    And my main function looks like this
    Code:
    int main(...) {
      MATRIX A(5,5);
      VECTOR b(5);
      ...
    }
    By the time it passes the declaration its already showing the problem

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Hmm, that really doesn't look like it should create problems.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User nepper271's Avatar
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    50
    Well, it doesn't create any error or warning (in g++ at least) and the code works normally (when it works). The only issue is that when something goes wrong I can't see what those variables are holding, and it makes it harder to find the problem.

    But thanks anyway.

  6. #6
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,158
    Are you compiling with any kind of -O option?

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Are you compiling with -g?

  8. #8
    Registered User nepper271's Avatar
    Join Date
    Jan 2008
    Location
    Brazil
    Posts
    50
    That's it, I forgot to include the -g option in the compilation of the class VECTOR, thank you for your help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. arithmetic on pointer to an incomplete type?
    By Volair in forum C Programming
    Replies: 4
    Last Post: 11-19-2006, 05:53 PM
  3. typename madness
    By zxcv in forum C++ Programming
    Replies: 4
    Last Post: 05-13-2006, 10:35 PM
  4. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 06:33 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

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