2010-05-03 6 views
0

j'ai quelques problèmes avec Eclipse, j'ai la structureavertissement dans 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; 
}; 

Et je ne peux pas compiler mon éclipse de code me donne une erreur:

  1. Erreur de syntaxe avant Liste
  2. pas de point-virgule à la fin de la structure ou de l'union
  3. L'ISO n'autorise pas les ";" J'ai dehors d'une fonction

aucune idée comment le changer, merci d'avance pour toute aide

+0

Qu'est-ce que 'List' - êtes-vous sûr de l'avoir déclaré? – Amarghosh

Répondre

1
  1. Vous devez montrer la définition de la liste des types, ce n'est pas un C type intégré.
  2. Cela pourrait être une erreur de suite à cause de 1.
  3. Cela pourrait aussi être juste que le compilateur devient confus.

De même, évitez les commentaires // en C, sauf si vous êtes sûr que vous compilez sous C99.

+0

J'utilise flag -std = c99 – lego69

+0

J'ai fait #define "list.h" là j'ai typedef struct List_t * List; – lego69

+0

@ lego69 Publiez le code de List.h dans votre question. Et l'as-tu # inclus avant le code pour le compte? –

3

Vous n'avez probablement pas défini List, ou #included le fichier d'en-tête qui le définit. Alternativement, vous l'avez défini/inclus (éventuellement comme une macro), et il y a quelque chose de très faux dans la définition. Cela n'a cependant rien à voir avec Eclipse - c'est comme ça que fonctionne le langage 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

Je travaille avec ADT – lego69

Questions connexes