Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Weird debugging problems

41 views
Skip to first unread message

Jeremy Penner

unread,
Aug 12, 1997, 3:00:00 AM8/12/97
to

I'm having trouble with the -g option. I use:
gcc leveled.c -g leveled.exe tilelib.o sprite.o -lalleg
and it spews out page after page of "multiple definitions" for every
function I use. Here's a sample:

leveled.exe(.text+0x1d8):crt0.s: multiple definition of `__exit'
c:/djgpp/lib\crt0.o(.text+0x1d8):crt0.s: first defined here
leveled.exe(.text+0x2c0):crt0.s: multiple definition of `__sbrk'
c:/djgpp/lib\crt0.o(.text+0x2c0):crt0.s: first defined here
leveled.exe(.text+0x4a4):crt0.s: multiple definition of
`_crt0_init_mcount'
c:/djgpp/lib\crt0.o(.text+0x4a4):crt0.s: first defined here
leveled.exe(.text+0x1304):crt0.s: multiple definition of `put_tile'
c:/djgpp/tmp\ccdaaaaa:leveled.c:144: first defined here
leveled.exe(.text+0x2d8):crt0.s: multiple definition of `__brk'
c:/djgpp/lib\crt0.o(.text+0x2d8):crt0.s: first defined here
leveled.exe(.text+0x4b0):crt0.s: multiple definition of
`update_screen'
c:/djgpp/tmp\ccdaaaaa:leveled.c:32: first defined here
leveled.exe(.text+0x0):crt0.s: multiple definition of `start'
c:/djgpp/lib\crt0.o(.text+0x0):crt0.s: first defined here
leveled.exe(.text+0x1470):crt0.s: multiple definition of `main'
c:/djgpp/tmp\ccdaaaaa:leveled.c:158: first defined here

This goes on for a while. Can anyone help me?

--Jeremy Penner
.....T,,...,.,,..... +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
,,,T:,.........))8.. | Jeremy Penner AKA ArmpitMan |
,.i,.,8,.......+.:#, I Friend Of the Naked Dancing Llama (FONDL) I
..+..+;,......T),.I, | Registered Llama Tipper |
..,+,=X#####HiTO;:). I Programmer (Author of BARNEY MUTILATOR!!!!) I
,,,,I8########8X)8,. | Web page author (members.tripod.com/~ArmpitMan) |
:,,=L8###########T,. I MOD and MIDI Composer I
:,.I.,LX######OT#:,, | Nerd with no social life whatsoever |
,...I;IXO#####L)H,.. I With an ASCII Llama in his .sig I
,...iiii;XI#8#888:,. | Best viewed white-on-black |
....iii,;:+)8##88i:: I Some may say my .sig is too big I
,...iii=.,T)8##88T+: | And they're probably right |
....i=+:,,,;iO888O,, I Download Barney Mutilator: I
,..,i==i)TLXX8888TI. | ftp://ftp.cdrom.com/pub/games/new/barney.zip |
,,::=+i)LOOX888888IT +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+

Robert Hoehne

unread,
Aug 13, 1997, 3:00:00 AM8/13/97
to pzp...@freenet.mb.ca

Jeremy Penner wrote:
>
> gcc leveled.c -g leveled.exe tilelib.o sprite.o -lalleg
[snip]

> This goes on for a while. Can anyone help me?

Simply insert a '-o' switch in the commandline above
before the output file, otherwise gcc links leveled.exe
in you program. That means your commandline should look:

gcc leveled.c -g -o leveled.exe tilelib.o sprite.o -lalleg

Robert
--
*****************************************************************
* Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau *
* Post: Am Berg 3, D-09573 Dittmannsdorf *
* e-Mail: Robert...@Mathematik.TU-Chemnitz.DE *
* WWW: http://www.tu-chemnitz.de/~rho *
*****************************************************************

Eli Zaretskii

unread,
Aug 14, 1997, 3:00:00 AM8/14/97
to Jeremy Penner

On Tue, 12 Aug 1997, Jeremy Penner wrote:

> I'm having trouble with the -g option. I use:

> gcc leveled.c -g leveled.exe tilelib.o sprite.o -lalleg

> and it spews out page after page of "multiple definitions" for every
> function I use. Here's a sample:

It's a cockpit error. You need to say this:

gcc leveled.c -g -o leveled.exe tilelib.o sprite.o -lalleg

In other words, -g does not come INSTEAD of -o, it comes IN ADDITION to
it. You still have to say -o leveled.exe.

George Foot

unread,
Aug 14, 1997, 3:00:00 AM8/14/97
to

On Tue, 12 Aug 1997 23:42:55 GMT, pzp...@freenet.mb.ca (Jeremy Penner)
wrote:

>I'm having trouble with the -g option. I use:
>gcc leveled.c -g leveled.exe tilelib.o sprite.o -lalleg

The -g option means to include extra debugging information. So your
command above is compiling leveled.c, and then linking the result with
leveled.exe, tilelib.o, sprite.o and the Allegro library. Linking one
eecutable into another doesn't make much sense :)

I think you are confusing -g with -o. -o makes the output go to the
next filename on the command line, rather than to the default (a.exe
and a.out in this case).

--
georg...@merton.oxford.ac.uk

Alexis Roda

unread,
Aug 18, 1997, 3:00:00 AM8/18/97
to pzp...@freenet.mb.ca

Jeremy Penner wrote:
>
> I'm having trouble with the -g option. I use:
> gcc leveled.c -g leveled.exe tilelib.o sprite.o -lalleg
> and it spews out page after page of "multiple definitions" for every
> function I use. Here's a sample:

Try

gcc -o leveled.exe -g leveled.c titlelib.o sprite.o -lalleg

it seems gcc is taking laveled.exe as an object file to link with rather
tan the output file, and it complains about multiple definition of
everything. I've just testet it with a simple hello_world-like program:

bash$ gcc linea.c -g linea.exe
linea.exe(.text+0x1d8):crt0.s: multiple definition of `__exit'
e:/gcc/lib\crt0.o(.text+0x1d8):crt0.s: first defined here
linea.exe(.text+0x2c0):crt0.s: multiple definition of `__sbrk'
e:/gcc/lib\crt0.o(.text+0x2c0):crt0.s: first defined here
linea.exe(.text+0x4a4):crt0.s: multiple definition of
`_crt0_init_mcount'
e:/gcc/lib\crt0.o(.text+0x4a4):crt0.s: first defined here
linea.exe(.text+0x2d8):crt0.s: multiple definition of `__brk'
e:/gcc/lib\crt0.o(.text+0x2d8):crt0.s: first defined here
linea.exe(.text+0x0):crt0.s: multiple definition of `start'
e:/gcc/lib\crt0.o(.text+0x0):crt0.s: first defined here
linea.exe(.text+0x4c4):crt0.s: multiple definition of `main'
e:/gcc/tmp\ccdaaaaa:linea.c:4: first defined here

while gcc -o linea.exe -g linea.c works fine.

Hope this helps.

Saludos
Alexis Roda

0 new messages