开发者

warning in Eclipse

I have some problems with Eclipse, I have structure

struct Account{
    const char* strLastName;      //Client's last name
    const char* strFirstName;     //Client's first name
    int nID;                //Client's ID number
    int nLines;             //Number of lines related to account
    double lastBill;        //Client's last bill for all lines
    List li开发者_StackOverflownesDataBase;
};

And I can't compile my code eclipse gives me an errors:

  1. Syntax error before List
  2. no semicolon at end of struct or union
  3. ISO does not allow extra ";" outside a function

I have no idea how to change it, thanks in advance for any help


Presumably you have not defined List, or #included the header file that does define it. Alternatively, you have defined/included it (possibly as a a macro), and there is something very wrong in the definition. This has nothing to do with Eclipse however - it's how the C language works.


  1. You need to show the definition of the type List, that's not a C built-in type.
  2. This might be a follow-on error because of 1.
  3. This too could just be that the compiler becomes confused.

Also, avoid // comments in C, unless you're sure that you're compiling as C99.


#ifndef LIST_H_
#define LIST_H_

#include <stdbool.h>
/**
 * Generic List Container
 *
 * Implements a list container type.
 * The list his an internal iterator for external use. For all functions
 * where the state of the iterator after calling that function is not stated,
 * it is undefined. That is you cannot assume anything about it.
 *
 * The following functions are available:
 *
 *   listCreate               - Creates a new empty list
 *   listDestroy              - Deletes an existing list and frees all resources
 *   listCopy                 - Copies an existing list
 *   listFilter               - Creates a copy of an existing list, filtered by
 *                              a boolean predicate
 *   listSize                 - Returns the size of a given list
 *   listFirst                - Sets the internal iterator to the first element
 *                              in the list, and returns it.
 *   listNext                 - Advances the internal iterator to the next
 *                              element and returns it.
 *   listInsertFirst          - Inserts an element in the beginning of the list
 *   listInsertLast           - Inserts an element in the end of the list
 *   listInsertBeforeCurrent  - Inserts an element right before the place of
 *                              internal iterator
 *   listInsertAfterCurrent   - Inserts an element right after the place of the
 *                              internal iterator
 *   listRemoveCurrent        - Removes the element pointed by the internal
 *                              iterator
 *   listFind                 - Attempts to set the internal iterator to the
 *                              next elements in the list that fits the criteria
 *   listSort                 - Sorts the list according to a given criteria
 *
 */

/**
 * Type for defining the list
 */
typedef struct List_t *List;...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜