Re: .cpp linking problem

2009-02-14 Thread Joseph Sinclair
It's hard to troubleshoot the exact problem without code, but this most often happens when a variable is declared *and* defined directly in a .h file. The solution, usually, is to *declare* the variable as "extern type blah;" in the include file and *define* the variable in one .c file as "type b

Re: .cpp linking problem

2009-02-14 Thread Jon M. Hanson
It sounds like you're getting the same header file included multiple times. If you look at the system header files you will see something like the following: #ifndef _STDIO_H #define _STDIO_H [Header file code here] #endif So the first time stdio.h is included the header file code will be

.cpp linking problem

2009-02-14 Thread unixprgrm...@gmail.com
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 uncomm