type declaration - dereferencing prob

This is a discussion on type declaration - dereferencing prob within the C Programming forums, part of the General Programming Boards category; hi! this is my declaration: Code: enum tKoerperart { einfach, komplex }; enum tGeometrie { wuerfel, kugel, zylinder, kegel }; ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    15

    type declaration - dereferencing prob

    hi!

    this is my declaration:
    Code:
     
    enum tKoerperart { einfach, komplex };
    enum tGeometrie { wuerfel, kugel, zylinder, kegel };
    ...
    typedef struct koerper{
    enum tKoerperart art;
    ...
    }tKoerper;
    
    typedef struct tKoerper *pKoerper;
    
    typedef struct objekt {
    ...
    pKoerper koerper;
    ...
    }tObjekt;
    
    typedef struct szenenGraph *pSzenenGraph;
    struct szenenGraph
    {
    tObjekt objekt;
    ...
    };
    i'm trying this:

    Code:
     
    void
    zeichneSzenenGraph(pSzenenGraph wurzelzeiger){
    ...
          if(wurzelzeiger->objekt.koerper!=(pKoerper)0){
            switch (wurzelzeiger->objekt.koerper->art) {
    	      case einfach: ...; 
                          ...
    	    }
    }
    ,and compiler says this:
    dereferencing pointer to incomplete type

    this is the referred line
    -->switch (wurzelzeiger->objekt.koerper->art)

    why?!
    any ideas?

    thanks for answers
    martin

  2. #2
    ~viaxd() viaxd's Avatar
    Join Date
    Aug 2003
    Posts
    246
    Code:
    typedef struct koerper{
    enum tKoerperart art;
    ...
    }tKoerper;
    
    typedef struct tKoerper *pKoerper;  /* don't need struct here */
    you don't need struct keyword there b/c it was already typedef'd.
    :wq

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    15
    great, this seemes to solve the problem.
    thanks a lot.

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, 04:35 PM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 05:33 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM

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