public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* multiple definition error
@ 2003-08-19 23:06 Robert Wimmer
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Wimmer @ 2003-08-19 23:06 UTC (permalink / raw)
  To: gcc-help

hi,

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

_________________________________________________________________
Die aktuellsten Computer News gibts auf MSN! http://www.msn.at/computer

^ permalink raw reply	[flat|nested] 5+ messages in thread

* multiple definition error
@ 2003-08-19 23:03 Robert Wimmer
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Wimmer @ 2003-08-19 23:03 UTC (permalink / raw)
  To: gcc-help

hi,

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: multiple definition error
  2001-03-10 12:49 wezy726
@ 2001-03-11  2:57 ` Jean-Pierre Schwickerath
  0 siblings, 0 replies; 5+ messages in thread
From: Jean-Pierre Schwickerath @ 2001-03-11  2:57 UTC (permalink / raw)
  To: GCC-List

Hi,

Thanks for the advice, I tried it, but it makes no difference, the make process
just fails at the same point. 
Do I need to have a working c++ compiler to compile gcc with languages c, c++
and objective-c ?



On Sat, 10 Mar 2001 15:42:35 -0500, wezy726 said:

> Try configuring gcc with an environment variable "CPPFLAGS" equal to '-Dre_max_failures=re_max_failures2'.
>  This stopped several of the packages I am building from giving a similar error, although I don't remember gcc being one of them.
>  
>  To set CPPFLAGS in bash / sh:
>  
>  set CPPFLAGS='stuff up there'  ;
>  configure ...  ;
>  unset CPPFLAGS   ;
>  make ...   ;
>  
>  If you're using tcsh / csh use `setenv` and `unsetenv` for `set` and `unset,` respectively.
>  
>  It is also possible to define the environment (CPPFLAGS) prior to the command on the same line in most shells.
>  
>  i.e. CPPFLAGS='stuff' configure ...  ;
>  
>  I hope this helps.
>  

-- 
Jean-Pierre Schwickerath - Powered by GNU/LinuX!
E-Mail: email@schwicky.net - http://schwicky.net
PGP Key ID: 0x48C39212 - AIM: Schwicky - ICQ's UIN: 4690141

Nothing's impossible... Everything is relative!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: multiple definition error
@ 2001-03-10 12:49 wezy726
  2001-03-11  2:57 ` Jean-Pierre Schwickerath
  0 siblings, 1 reply; 5+ messages in thread
From: wezy726 @ 2001-03-10 12:49 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

Try configuring gcc with an environment variable 
"CPPFLAGS" equal to '-Dre_max_failures=re_max_failures2'.
This stopped several of the packages I am building 
from giving a similar error, although I don't remember gcc being one of 
them.
 
To set CPPFLAGS in bash / sh:
 
set CPPFLAGS='stuff up there'  ;
configure ...  ;
unset CPPFLAGS   ;
make ...   ;
 
If you're using tcsh / csh use `setenv` and 
`unsetenv` for `set` and `unset,` respectively.
 
It is also possible to define the environment 
(CPPFLAGS) prior to the command on the same line in most shells.
 
i.e. CPPFLAGS='stuff' configure ...  
;
 
I hope this helps.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* multiple definition error
@ 2001-03-10  1:02 Jean-Pierre Schwickerath
  0 siblings, 0 replies; 5+ messages in thread
From: Jean-Pierre Schwickerath @ 2001-03-10  1:02 UTC (permalink / raw)
  To: GCC-List

Hello,

I'm trying to compile the gcc snapshot of march 5th for a LFS system. 
I want to make a static version now. 
The basis system is a SuSE 7.0. 
I made a 
./gcc-20010305/configure --prefix=/usr
--with-gxx-include-dir=/usr/include/g++\
--enable-languages=c,c++ --disable-nls && make -e LDFLAGS=-static bootstrap

and I get the following error 

make[3]: Entering directory `/LFS/usr/src/sources/gcc-stat/gcc/fixinc'
gcc -DIN_GCC -g -O2  -W -Wall -Wwrite-strings -Wstrict-prototypes
-Wmissing-prot
otypes -Wtraditional -pedantic -Wno-long-long -I. -I..
-I/LFS/usr/src/sources/gc
c-20010305/gcc/fixinc -I/LFS/usr/src/sources/gcc-20010305/gcc/fixinc/..
-I/LFS/u
sr/src/sources/gcc-20010305/gcc/fixinc/../config
-I/LFS/usr/src/sources/gcc-2001
0305/gcc/fixinc/../../include -static -o fixincl fixincl.o fixtests.o
fixfixes.o
 server.o procopen.o gnu-regex.o fixlib.o ../../libiberty/libiberty.a
/usr/lib/libc.a(regex.o): In function `init_syntax_once':
/usr/src/packages/BUILD/glibc-2.1/posix/regex.c:257: multiple definition of
`re_
max_failures'
gnu-regex.o:/LFS/usr/src/sources/gcc-20010305/gcc/fixinc/gnu-regex.c:175: first
defined here
collect2: ld returned 1 exit status
make[3]: *** [full-stamp] Error 1
make[3]: Leaving directory `/LFS/usr/src/sources/gcc-stat/gcc/fixinc'
make[2]: *** [fixinc.sh] Error 2
make[2]: Leaving directory `/LFS/usr/src/sources/gcc-stat/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/LFS/usr/src/sources/gcc-stat/gcc'
make: *** [bootstrap] Error 2

Could you tell me how I can solve this problem? 
I tried to compile a stable release, but it always fails configuring the
libstdc++ saying that something's wrong with ltconfig and
build=i586-pc-linux-gnu is a unrecognized option. 
With the snapshot the configuring of libstdc++ wents on well, but I get the
error above...

Thanks for your help

Jean-Pierre 

-- 
Jean-Pierre Schwickerath - Powered by GNU/LinuX!
E-Mail: email@schwicky.net - http://schwicky.net
PGP Key ID: 0x48C39212 - AIM: Schwicky - ICQ's UIN: 4690141

Nothing's impossible... Everything is relative!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-08-19 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-19 23:06 multiple definition error Robert Wimmer
  -- strict thread matches above, loose matches on Subject: below --
2003-08-19 23:03 Robert Wimmer
2001-03-10 12:49 wezy726
2001-03-11  2:57 ` Jean-Pierre Schwickerath
2001-03-10  1:02 Jean-Pierre Schwickerath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).