Eclipse中的警告

时间:2010-05-03 11:41:23

标签: c

我有一些Eclipse问题,我有结构

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 linesDataBase;
};

我无法编译我的代码eclipse给了我一个错误:

  1. 列表
  2. 之前的语法错误
  3. 结构或联合结束时没有分号
  4. ISO不允许额外的“;”在功能之外
  5. 我不知道如何改变它,提前感谢任何帮助

3 个答案:

答案 0 :(得分:3)

据推测,您尚未定义List#included定义它的头文件。或者,您已定义/包含它(可能作为宏),并且定义中存在一些非常错误的内容。这与Eclipse无关 - 它就是C语言的工作方式。

答案 1 :(得分:1)

  1. 您需要显示List类型的定义,这不是C内置类型。
  2. 由于1,这可能是一个后续错误。
  3. 这也可能只是编译器变得混乱。
  4. 另外,请避免使用C中的//条评论,除非您确定要编译为C99。

答案 2 :(得分:0)

#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;...