M
Michael.Z
Anyone who can help:
Given a Table.h file I am writing a Table.c file.
I keep getting the compile error:
previous declaration of Table was here / conflicting types for
I think the problem was the result of two pieces of code.
First: typedef struct Table; /* in Table.c*/
Second: struct Table { /*struct definition */ } *Table; /* in
Table.h */
How can I solve the problems?
Here are the two files
/* * * * * * * * * * * * * * * * * * * * * * *
Header file:
* * * * * * * * * * * * * * * * * * * * * * */
#ifndef TABLE_H
#define TABLE_H
#include "bool.h"
typedef void * Table ;
typedef void * DataT ;
typedef struct {
// unsigned successful ; double unsuccessful ;
unsigned successfulNumerator , successfulDenominator ;
unsigned unsuccessfulNumerator , unsuccessfulDenominator ;
} Perform ;
Table
makeTable ( int sizeTable , unsigned sizeData , int (*diff)() ,
unsigned (*hash)() , void * (*copy)() , void (*free)() ) ;
#endif
/* * * * * * * * * * * * * * * * * * * * * * *
Table.c
* * * * * * * * * * * * * * * * * * * * * * */
#include "Table.h"
typedef struct Table{
int sizeTable;
unsigned sizeData;
int (*diff)();
unsigned (*hash)();
void *(*copy)();
void (*free)();
} * Table;
Table
makeTable ( int sizeTable , unsigned sizeData , int (*diff)() ,
unsigned (*hash)() , void * (*copy)() , void (*free)() ) {
}
Given a Table.h file I am writing a Table.c file.
I keep getting the compile error:
previous declaration of Table was here / conflicting types for
I think the problem was the result of two pieces of code.
First: typedef struct Table; /* in Table.c*/
Second: struct Table { /*struct definition */ } *Table; /* in
Table.h */
How can I solve the problems?
Here are the two files
/* * * * * * * * * * * * * * * * * * * * * * *
Header file:
* * * * * * * * * * * * * * * * * * * * * * */
#ifndef TABLE_H
#define TABLE_H
#include "bool.h"
typedef void * Table ;
typedef void * DataT ;
typedef struct {
// unsigned successful ; double unsuccessful ;
unsigned successfulNumerator , successfulDenominator ;
unsigned unsuccessfulNumerator , unsuccessfulDenominator ;
} Perform ;
Table
makeTable ( int sizeTable , unsigned sizeData , int (*diff)() ,
unsigned (*hash)() , void * (*copy)() , void (*free)() ) ;
#endif
/* * * * * * * * * * * * * * * * * * * * * * *
Table.c
* * * * * * * * * * * * * * * * * * * * * * */
#include "Table.h"
typedef struct Table{
int sizeTable;
unsigned sizeData;
int (*diff)();
unsigned (*hash)();
void *(*copy)();
void (*free)();
} * Table;
Table
makeTable ( int sizeTable , unsigned sizeData , int (*diff)() ,
unsigned (*hash)() , void * (*copy)() , void (*free)() ) {
}