delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/05/13/07:30:13

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Undefined reference to __alloca
Date: 13 May 2004 11:22:43 GMT
Lines: 44
Message-ID: <2gh443F2hodpU2@uni-berlin.de>
References: <200405130450 DOT i4D4oGfA022126 AT delorie DOT com>
X-Complaints-To: http://news.cis.dfn.de/abuse.html
X-Trace: news.uni-berlin.de VBRUjBbYtd1RO9uZMKJMfQUoplwDPwO4b9ngbpcqP1lfADzQnmnBv292+5
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

davin-libsdl4893 AT mailblocks DOT com wrote:
> I get the following linker error
> when I run make game.exe:

> cd d:/research/2004/djgpp-game/
> make game.exe
> c:/djgpp/bin/gpp.exe game.o -o .exe -lstdcxx -lm

That line shows several actual or potential problems:

1) you should not have to call gpp.exe by an absolute path.  
2) since you're using gpp.exe, there's no need to -lstdcxx
3) the output file name ".exe" is certainly not what you want it to be.

> game.o(.text+0x3b):game.cc: undefined reference to `__alloca'

Please compile with debug info turned on ("-g" flag).  That'll resolve
the error message to a function and line number.

And in case you're not doing that yet (and your Makefile shows no sign
of it): turn on optimization.  GCC at least historically had some
problems when you compiled C++ code with no optimization at all.

> Here is my Makefile:

> BIN=c:/djgpp/bin

> %.run: %.exe
> /$*.exe

I'll assume there's a <Tab> and a "." before the "/" in that line in
your actual file?  (Hint: leading "." will get eaten by mail systems).

> game.exe: game.o
> $(BIN)/gpp.exe $^ -o $*.exe

(Again, something ate the <Tab>)

And no rule at all how to produce game.o?  Are you sure it's compiled
from your 'game.cc'?  By *this* version of GCC?

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019