this is my compilation error:
obj/linux64/Release/src/ofApp.o:(.bss+0x0): memy'被多次定义 obj/linux64/Release/src/main.o:(.bss+0x0):第一次在此定义 obj/linux64/Release/src/schedule.o:(.bss+0x0):
memy’被多次定义
obj/linux64/Release/src/main.o:(.bss+0x0):第一次在此定义
my program is roughly like this:
class Schedule{
public:
void init();
void add_in(int i);
void alloc(MEMORY* ptr,MEMORY * assign);
void free(MEMORY* ptr,int i); //sequence algorithm
void free_optimist(MEMORY* ptr,int i); //optimist algorithm
void sort(MEMORY* ptr);
void insert(MEMORY* queue,MEMORY* ptr);
}
I have a struct here:
struct memory{
struct memory* pre;
struct memory* next;
int id;
int address;
int size;
int state; //0:free 1:busy
};
typedef struct memory MEMORY;
MEMORY * memy;
But I don’ know where to put the definition of the struct. Previously I put it in another .h file, then I put it in the schedule class,but happened with the same error.
The main point is ,most of the functions in Schedule class are dealed with MEMORY.
Asking for your help ! Urgently!