Dear Justin Thank you, but first I tested Eddie Offermann´s suggestion to use: extern const char *kXPSName; in my header file, and it solved my problem. Nevertheless I decided to wrap the #include statements in the #ifndef statements. Long time ago I did this all the time, but with root I have abandonded it because everythink seems to work fine w/o it. Best regards Christian Justin Findlay wrote: > On Mon Dec 15 2003 - 00:26:00 MET cstrato wrote: > > >>In the header file XPSApp.h I have defined: >> const char *kXPSName = "This is text"; >>//or: static const char *kXPSName = "This is text"; >> >>In a couple of source files I "#include XPSApp.h" Sorrowly, at the end >>of the compilation I get the error: >> >>ld: multiple definitions of symbol _kXPSName XDataFrame.o definition of >>_kXPSName in section (__DATA,__data) XPSApp.o definition of _kXPSName in >>section (__DATA,__data) make: *** [XPSApp] Error 1 >> >>Do you know how I can define kXPSName so that I can use it in multiple >>source files? > > > This may be your problem, forgive me if it is not. Tell the preprocessor > to include your header once only by adding the following lines to your > header file (every header file you ever happen to write). > > $ cat XPSApp.h > #ifndef _XPSAPP_H_ > #define _XPSAPP_H_ > > //code... > //... > > #endif //_XPSAPP_H_ > > What this means to the preprocessor is "if the following code has been > included already, don't include it again". The preprocessor browses > through the source code and notes this conditional definition (lines > beginning with `#' actuate preprocessor activity) in your hapless header > file. > > > Justin > > > > >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET