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:
- Syntax error before List
- no semicolon at end of struct or union
- 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.
- You need to show the definition of the type List, that's not a C built-in type.
- This might be a follow-on error because of 1.
- 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;...
精彩评论