i am c++ newbie. i wrote a view tools for using X11 in c and they compiled well. but now i have rewritten some of these modules in c++ (only the tool using x11 primitives is still in c) and compiling them i always get errors like this
*************************** gcc -o style style.cpp X_TOOL.o X_STYLE.o -L/usr/X11R6/lib -lm -lX11 X_STYLE.o(.bss+0x10): multiple definition of `X_Blue' /tmp/ccjmheIq.o(.bss+0x10): first defined here X_STYLE.o(.bss+0x8): multiple definition of `X_Red' /tmp/ccjmheIq.o(.bss+0x8): first defined here ************************** this is my makefile
************************** stylemake *******************
style : X_STYLE.o X_TOOL.o style.o
gcc -o style X_TOOL.o X_STYLE.o style.o -L/usr/X11R6/lib -lm -lX11
style.o : style.cpp X_STYLE.h gcc -c -Wall style.cpp
X_STYLE.o : X_STYLE.cpp X_STYLE.h gcc -c -Wall X_STYLE.cpp
X_TOOL.o : X_TOOL.c X_TOOL.h gcc -c -Wall X_TOOL.c -I/usr/X11R6/include
********************* eof ********************************
i always use the
#ifndef .... # define .... .... # endif
statement at the beginning of my haeder files, and also the extern "C" command for including the tool written in c.
*************************** top of X_STYLE.h ***********************
# ifndef _X_STYLE_H # define _X_STYLE_H
extern "C" { # include "X_TOOL.h" // X_TOOL.h starts with : ifndef X_TOOL_H define ... }
typedef enum { LEFT, CENTER, RIGHT } X_STYLE_HALIGN; typedef enum { TOP, MIDDLE, BOTTOM } X_STYLE_VALIGN; typedef struct { int left,top,bottom,right; } X_STYLE_Margin; typedef struct { X_Pixel left,top,bottom,right; } X_STYLE_BorderColor;
class X_Style {
private :
char *name; X_STYLE_Margin margin, border, padding; X_Pixel color, bgcolor; X_STYLE_BorderColor bordercolor; X_STYLE_HALIGN halign; X_STYLE_VALIGN valign; X_Font *font;
*********************************************************************
please can anyone help me
thanks,
sepp wimmer
_________________________________________________________________
Messenger - Wer in Echtzeit kommunizieren will, lädt den MSN Messenger. Cool, kostenlos und mit 3D Emoticons: http://messenger.msn.at