2010-05-03 86 views
0

我有一些问题与Eclipse,我有结构警告在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; 
}; 

我不能编译我的代码日食给我一个错误:

  1. 语法错误列表
  2. 前结构或联合的末尾没有分号
  3. ISO不允许额外的“;”功能

之外我不知道如何去改变它,在此先感谢您的帮助

+0

什么是'List' - 你确定你已经声明了它吗? – Amarghosh 2010-05-03 11:47:04

回答

1
  1. 你需要显示类型列表中的定义,这不是内置类型的C值。
  2. 这可能是因为1而导致的后续错误。
  3. 这也可能是编译器变得混乱。

此外,避免//在C中的评论,除非您确定您编译为C99。

+0

我使用标志-std = c99 – lego69 2010-05-03 11:48:38

+0

我做了#define“list.h” 那里我有typedef struct List_t * List; – lego69 2010-05-03 11:49:35

+0

@ lego69在您的问题中发布来自List.h的代码。你是否在Account的代码之前包含它? – 2010-05-03 11:52:15

3

想必您还没有定义List#included确定它的头文件。或者,你已经定义/包含它(可能是一个宏),并且定义中有一些非常错误的东西。但这与Eclipse无关 - 这就是C语言的工作原理。

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;... 
+0

我正在使用ADT – lego69 2010-05-03 11:58:11