doubt using libraries in g++ linker
Hi,
I am having some trouble when I try to link my custom libraries to target executables.
There are two libraries
liba
libb
and an executable exec based on main.o
The library libb has some reference to liba. Now if I put the libraries in same directories, I can compile the code as
g++ -o exec main.o liba.a libb.a
But, if I put the libraries in different directories, say d1 and d2, and use the command as
g++ -o exec main.o d1/liba.a d2/libb.a
I get an error as undefined reference to some function in liba. I am not sure if I am missing some thing in linking process.
Also, if libb doesnot refer any functions in liba, there is no error in either of the case.
Please advise...
|