I have a lot of binary files from bin2c and when I want to access same array from two c
files I get this error (I'm using gcc and make)
/tmp/ccLmMGZb.o:(.data+0x154f4): multiple definition of `first_array'
/tmp/ccDt1r4t.o:(.data+0xd5b8): first defined here
/tmp/ccXFhI7r.o:(.data+0x0): multiple definition of `first_array'
/tmp/ccDt1r4t.o:(.data+0xd5b8): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:120: all] Error 1
here is first.h
unsigned char first_array[] =
{160, 16, 0, 0, 0, 8,....blahblahbla };
file1.c
#include"pathto/first.h"
function(&irelevant1,&irelevant2,&first_array,sizeof(first_array)); //this is decompresion wrapper btw
and file2.c is the same.
I tried to make output bin2c .c(instead of .h) files and make one single header like this
#include"pathto/first.c"
extern unsigned char first_array[];
and include it in file file1.c and file2.c without first.h but it only made it worse,all arrays now got multiple definition
then I made this:
#ifndef FIRST
#define FIRST
#include"pathto/first.c"
extern unsigned char first_array[];
#endif
but result is exaclty the same as in first try.
I tried also lot of random stuff which i don't remember but it also didn't helped,or make even more problems with sizeof(first_array). Any help would be appreciatedn,thanks.
TL;DR i try to include same header in more files and it don't work.