Say we are building an EXE which utilizes two
static
libraries,
external_1.lib and
external_2.lib.
external_1.lib has two functions
FunA()
and
FunB()
,
while
external_2.lib has
FunA()
and
FunC()
.
Note:
FunA() is there in both the libs !!!, which is practical in the real world.
Now in our EXE's
main()
, we have code like shown below:
void main()
{
FunB(); FunC();
FunA(); }
The compiler will obviously throw a linker error saying that
FunA
is there in multiple objs.
If both these libs are of 3rd party, then we cannot compile them. How to resolve this ??
Simple. Use the linker option
/FORCE:MULTIPLE
Check this link:
http://msdn.microsoft.com/en-us/library/70abkas3.aspx[
^]