I build two libraries called templib1.a and templib2.a
And some global variables and function names in templib1.a and templib2.a are the same; when I try to compile my c code with these two libraries, it failed.
Is there any method except namespace for solving this problem? Do I need to re-build the libraries? Thanks.
=======================================================================
I build libraries as following
build templib1.a from aaa.c bbb.c ddd.c aaa.h; there is global variable int var_a, int var b; and functions void func_a(), void func_b() in aaa.c and bbb.c respectively
build templib2.a from aaa.c bbb.c eee.c aaa.h; there is global variable int var_a, int var b; and functions void func_a(), void func_b() in aaa.c and bbb.c respectively
And I my c code like
gcc $(INC) $(TEMPLIB1_DIR)/templib1.a $(TEMPLIB2_DIR)/temp2lib.a -o run
and it shows
"multiple definition of var_a temp2lib.a : first defined here"
"multiple definition of var_b temp2lib.a : first defined here"