error: storage class specified for parameter

This is a discussion on error: storage class specified for parameter within the C Programming forums, part of the General Programming Boards category; Hi, I am having this compiling error: queue_linked.h:18: error: storage class specified for parameter ‚QueueEntry‚ queue_linked.h:21: error: expected specifier-qualifier-list before ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    27

    error: storage class specified for parameter

    Hi, I am having this compiling error:

    queue_linked.h:18: error: storage class specified for parameter ‚QueueEntry‚
    queue_linked.h:21: error: expected specifier-qualifier-list before ‚QueueEntry‚
    queue_linked.h:23: error: storage class specified for parameter ‚QueueNode‚
    queue_linked.h:26: error: expected specifier-qualifier-list before ‚QueueNode‚
    queue_linked.h:29: error: storage class specified for parameter ‚Queue‚
    queue_linked.h:31: error: expected ‚)‚ before ‚*‚ token

    Code:
    //prevents multiple inclusions of header file
    #ifndef QUEUE_L_H
    #define QUEUE_L_H
    
    #include <stdio.h>
    #include <stdlib.h>
    #include "common.h"
    
    #define MAXCHAR 35
    #define KEYSIZE 3
    
    typedef struct queueentry{
            char key[KEYSIZE + 1];
    }QueueEntry;
    
    typedef struct queuenode {
        QueueEntry info;
        struct queuenode *next;
    } QueueNode;
    
    typedef struct queue {
        QueueNode *front;
        QueueNode *rear;
        int size;
    } Queue;
    
    void CreateQueue(Queue *q);
    Boolean QueueEmtpy(Queue *);
    Boolean QueueFull(Queue *);
    void Append(QueueEntry, Queue *);
    void Serve(QueueEntry *, Queue *);
    void AppendNode(QueueNode *, Queue *);
    void ServeNode(QueueNode *, Queue *);
    int QueueSize(Queue *);
    void ClearQueue(Queue *);
    void QueueFront(QueueEntry *, Queue *q);
    void TraverseQueue(Queue *, void(*)(QueueEntry));
    
    #endif
    Any help as always will be greatly appreciated

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I'm not sure which lines the line numbers point to, but: is there something hanging off the end of common.h?

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    Quote Originally Posted by tabstop View Post
    I'm not sure which lines the line numbers point to, but: is there something hanging off the end of common.h?
    The lines that the line numbers are pointing to are in red.
    I don't understand what do you mean by hanging off the end of common.h?
    common.h is inside the quotation marks.


    Code:
    //prevents multiple inclusions of header file
    #ifndef QUEUE_L_H
    #define QUEUE_L_H
    
    #include <stdio.h>
    #include <stdlib.h>
    #include "common.h"
    
    #define MAXCHAR 35
    #define KEYSIZE 3
    
    typedef struct queueentry
            char key[KEYSIZE + 1];
    }QueueEntry;
    
    typedef struct queuenode {
        QueueEntry info;
        struct queuenode *next;
    } QueueNode;
    
    typedef struct queue {
        QueueNode *front;
        QueueNode *rear;
        int size;
    } Queue;
    
    void CreateQueue(Queue *q);
    Boolean QueueEmtpy(Queue *);
    Boolean QueueFull(Queue *);
    void Append(QueueEntry, Queue *);
    void Serve(QueueEntry *, Queue *);
    void AppendNode(QueueNode *, Queue *);
    void ServeNode(QueueNode *, Queue *);
    int QueueSize(Queue *);
    void ClearQueue(Queue *);
    void QueueFront(QueueEntry *, Queue *q);
    void TraverseQueue(Queue *, void(*)(QueueEntry));
    
    #endif

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I mean that maybe common.h ends, somehow, with the word "extern" or something, due to a bad cut'n'paste. Then, since the contents of common.h are just slopped at the top of this file, that extern would then be modifying typedef struct queueentry, and that would contribute to this chain of errors that you see.

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    Quote Originally Posted by tabstop View Post
    I mean that maybe common.h ends, somehow, with the word "extern" or something, due to a bad cut'n'paste. Then, since the contents of common.h are just slopped at the top of this file, that extern would then be modifying typedef struct queueentry, and that would contribute to this chain of errors that you see.

    Thanks, I'll work on that now and see if it goes away.

  6. #6
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    I checked common.h. I don't see anything wrong with it. =/

    common.h:
    Code:
     //#define DEBUG  // turns on debug
    
    
    // prevents multiple inclusions of header file
    #ifndef COMMON_H
    #define COMMON_H
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    typedef enum boolean {FALSE, TRUE} Boolean;
    
     void Error(char *);
    
     void Warning(char *);
    
    #endif

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I can't reproduce the error here. I had forgotten that "typedef" is technically a storage class specifier, so that's what's being complained about. Somehow, the compiler thinks it's looking at a function there.

    Is that really your common.h? Why all the includes then? I don't know if you can get away with it with your setup; but try taking it out (copying the enum declaration into your source).

  8. #8
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    typedef struct queueentry

    should be
    Code:
    typedef struct queueentry {
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  9. #9
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    Quote Originally Posted by vart View Post
    typedef struct queueentry

    should be
    Code:
    typedef struct queueentry {
    Thanks! However, it is still producing the same error. =/

  10. #10
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    Quote Originally Posted by tabstop View Post
    I can't reproduce the error here. I had forgotten that "typedef" is technically a storage class specifier, so that's what's being complained about. Somehow, the compiler thinks it's looking at a function there.

    Is that really your common.h? Why all the includes then? I don't know if you can get away with it with your setup; but try taking it out (copying the enum declaration into your source).
    It was given.

  11. #11
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Quote Originally Posted by aim4sky View Post
    Thanks! However, it is still producing the same error. =/
    Post the compilable sample reproducing your problem.
    I can compile both your h-files without problems...

    Do you have something included before them in your c-file?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  12. #12
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    The error I am getting is:

    cc -c -o radix.o radix.c
    In file included from radix.c:12:
    queue_linked.h:20: error: storage class specified for parameter &#226;QueueEntry&#226;
    queue_linked.h:23: error: expected specifier-qualifier-list before &#226;QueueEntry&#226;
    queue_linked.h:25: error: storage class specified for parameter &#226;QueueNode&#226;
    queue_linked.h:28: error: expected specifier-qualifier-list before &#226;QueueNode&#226;
    queue_linked.h:31: error: storage class specified for parameter &#226;Queue&#226;
    queue_linked.h:33: error: expected &#226&#226; before &#226;*&#226; token
    make: *** [radix.o] Error 1

    radix.c (line 12 is in red):
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "common.h"
    #include "genlist.h"
    #include "queue_linked.h"
    #include "sort.h"
    
    void Introduction(void);
    void Help(void);
    char GetCommand(void);
    void DoCommand(char, List*);
    
    int main(void)
    {
            List list;
    
            Introduction();
            CreateList(&list);
    
            /*endless loop: DoCommand() will call exit() to end the program.  */
            while(TRUE)
                    DoCommand(GetCommand(), &list);
            return 1;  //This statement should never be executed.
    
    }
    
    /*=======================================*/
    I've tried putting "queue_linked.h" before "genlist.h". This gives me a similiar compling error.
    Then I've tried putting "common.h" at the end and it still gives me the same compling error.

    The source code is big. If you need the rest, I'll post it.
    Thanks for helping!
    Last edited by aim4sky; 03-17-2008 at 12:00 AM.

  13. #13
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    You should start with compiling only one header at a time

    create c-file like
    Code:
    #include "queue_linked.h"
    int main(void)
    {
       return 0;
    }
    and compile it

    then replace queue_linked with each header in your project and see - if each one can be compiled by itself
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  14. #14
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    Quote Originally Posted by vart View Post
    You should start with compiling only one header at a time

    create c-file like
    Code:
    #include "queue_linked.h"
    int main(void)
    {
       return 0;
    }
    and compile it

    then replace queue_linked with each header in your project and see - if each one can be compiled by itself
    Thanks! I'll do that now.

  15. #15
    Registered User
    Join Date
    Mar 2008
    Posts
    27
    when I complie the following:
    Code:
    #include "genlist.h"
    
    int main(void)
    {
            return 0;
    }
    I get this error:
    4: error: expected &#226;;&#226;, &#226;,&#226; or &#226&#226; before &#226;{&#226; token

    when I compile this:
    Code:
    #include "sort.h"
    
    int main(void)
    {
            return 0;
    }
    I get the following error:
    In file included from sort.h:9,
    from sortt.c:1:
    queue_linked.h:20: error: storage class specified for parameter &#226;QueueEntry&#226;
    queue_linked.h:23: error: expected specifier-qualifier-list before &#226;QueueEntry&#226;
    queue_linked.h:25: error: storage class specified for parameter &#226;QueueNode&#226;
    queue_linked.h:28: error: expected specifier-qualifier-list before &#226;QueueNode&#226;
    queue_linked.h:31: error: storage class specified for parameter &#226;Queue&#226;
    queue_linked.h:33: error: expected &#226&#226; before &#226;*&#226; token

    sort.h:
    Code:
    #include "common.h"
    #include "genlist.h"
    #include "queue_linked.h"
    
    #define MAXQUEUEARRAY 28
    
    void RadixSor(List *);
    int QueuePosition(char);
    void Rethread(List *, Queue);

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 08:10 AM
  3. Defining derivated class problem
    By mikahell in forum C++ Programming
    Replies: 9
    Last Post: 08-22-2007, 02:46 PM
  4. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM

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