Thread: error: expected specifier-qualifier-list at the end of input

  1. #1
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187

    error: expected specifier-qualifier-list at the end of input

    Code:
    typedef struct 
    { int flag ; //1 if 0 atrib
      union { 
    	char *cond;
            struct  {
                    char *var;
                    char *exp;
                   } atrib;
            } conteudo;
    Any idea why this is happening ?

  2. #2
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187
    Noticed it's missing a } in the end but still doesn't work.

    Gives me this error now :

    error: expected identifier or ‘(’ at end of input

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What are you trying to do?
    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

  4. #4
    C Beginner
    Join Date
    Dec 2011
    Location
    Portugal
    Posts
    187
    Just defining that structure.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by DeanWinchester
    Just defining that structure.
    What structure?

    Let me put it this way: you have in mind a structure. You want to express it in code, but you have a problem in doing so. Therefore, you should express it in code to tell us what you have in mind, then we can help you express it in code. Instead, when asked to explain, you just state the obvious that you have in mind a structure. Therefore, the most logical answer to your question is to be equally vague:

    Quote Originally Posted by DeanWinchester
    Any idea why this is happening ?
    Yes, you made a mistake in your code.

    Doesn't help very much, does it?
    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

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Why are you trying to embed the union, and another structure inside your structure? Proper indentation might actually be able to help you see where your problem lies.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 02-15-2011, 01:51 AM
  2. expected specifier-qualifier-list ip.h
    By quantt in forum C Programming
    Replies: 1
    Last Post: 02-12-2009, 10:24 AM
  3. specifier-qualifier-list
    By Raman in forum C Programming
    Replies: 2
    Last Post: 11-04-2008, 08:12 AM
  4. error: expected specifier-qualifier-list before
    By chinook86 in forum C Programming
    Replies: 6
    Last Post: 03-01-2008, 02:02 AM
  5. Replies: 1
    Last Post: 01-24-2008, 01:07 PM