Hi,
I want to do this. Suppose I have a source file abc.c:
abc.c
int a
another source file test-lib.c which leverage a from abc.c
test-lib.c
#include "abc.c"
extern int a;
int main()
{
return 0;
}
Now suppose abc.c is only available as abc.o (source code not available). And I want to link test-lib.o with abc.o using these commands
g++ -c test-lib.c
g++ -o op.o abc.o test-lib.o
I am getting this compilation error:
test-lib.o:(.data+0x0): multiple definition of `a'
abc.o:(.data+0x0): first defined here
collect2: ld returned 1 exit status
I am not sure what went wrong. I did according to:
http://www.eskimo.com/~scs/cclass/notes/sx5d.html
Crying for help here.
Thanks.