Thread: problem with structure !!!!

  1. #1
    Registered User
    Join Date
    Apr 2009

    problem with structure !!!!

    Hello all
    I've wrote this header file
    struct sign
        char sign;
    struct identifier
        char *variable;
        double number;
        struct identifier *id;
    struct lib 
        char hash;
        char *include;
        signlib sign1;
        identify lib_name;
        char dot ;
        char h;
        signlib sign2;
    and when I compiled it i have this error message :
    PHP Code:
    tree.h:18 errorexpected specifier-qualifier-list before signlib 
    can any one tell me what is the problem ???

  2. #2
    Registered User
    Join Date
    Feb 2009
    The compiler does not have enough information, that is the problem.

    You should try something like these:

    typedef struct signlib
        char sign;

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    adrian2009's suggestion looks correct. The problem is that in the original example, signlib is a variable of type struct sign.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem getting structure to work in my function
    By Tom Bombadil in forum C Programming
    Replies: 18
    Last Post: 05-28-2009, 09:53 AM
  2. Problem with structure and class
    By Bargi in forum C++ Programming
    Replies: 3
    Last Post: 09-25-2007, 02:30 AM
  3. Problem with arrays inside a structure
    By babu in forum C Programming
    Replies: 4
    Last Post: 07-12-2007, 09:35 AM
  4. accessing structure pointer problem
    By godhand in forum C Programming
    Replies: 2
    Last Post: 04-09-2004, 10:52 PM
  5. Problem checking for numeric value in a structure
    By ronkane in forum C++ Programming
    Replies: 4
    Last Post: 01-20-2002, 02:53 PM