.cpp linking problem

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: unixprgrmr01@gmail.com
Date:  
To: plug-discuss
Subject: .cpp linking problem
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

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss