.cpp linking problem

unixprgrmr01 at gmail.com unixprgrmr01 at gmail.com
Sat Feb 14 20:03:35 MST 2009


I am trying to link library xy.a composed of x.o containing function x() and
y.o containing function y() with d.o giving executable d

I call both x() and y() from d.cpp.  When I comment out the function call to
y() in d.cpp it links just fine with library xy.a giving executable d BUT
when I uncomment the function call to y() I get duplicate variable
declaration errors.

Note that I need x.o and y.o in a library because I also link them with e.o
to give executable e . Both x() and y() are called from both d and e
executables.

I use the same custom include files in x.o y.o d.o and e.o. I am getting
duplicate variable errors from the variables declared in these custom
include files.

I also include standard include files such as <stdio.h> and <math.h> etc.
etc. in all 4 .o's but I don't get duplicate variable errors from these.

I am #ifndef ing the entire include file just as is done with <stdio.h> etc.
What am I doing wrong, that at link time I get duplicate variable errors?

Thanks for your help!

-- 
Best Regards,
Lynn P. Tilby
Ph: 480 632-8635
unixprgrmr01 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20090214/d93f23c8/attachment.htm 


More information about the PLUG-discuss mailing list