www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/05/13:03:14

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP wierd compilation error
Date: Mon, 30 Jun 1997 21:23:53 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 32
Message-ID: <33B823E9.6546@cs.com>
References: <33B775B9 DOT D567D103 AT wayfarer DOT demon DOT co DOT uk>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp210.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Dan wrote:
> 
> I'm having a problem compiling in DJGPP - I wonder if anyone has seen
> the same thing.
> 
> Basically, on compilation, the syntax checker does not notice mis-typed
> library function calls, for example 'helloworld()' instead of
> 'hello_world()'. I can then compile and link the program, which then
> obviously crashes on execution, due to a call to the non-existent
> 'helloworld()' function.

This is not a problem with the compilation; it's the way gcc (and most C
compilers AFAIK) handle undeclared functions.  If you call a function
named 'helloworld()' in your code, the compiler assumes that this symbol
will become defined at some point in the future and doesn't worry about
it, trusting the linker to catch any problems and stop with an error. 
(If you compile with '-Wall' you'll be warned about implicit function
declarations.)

That the linker does not stop indicates that you have replaced the
default linker with another; possibly the one from RSXDJ131.  This
linker theoretically has been modified so as not to give errors for
undefined references.  Somebody posted a solution of sorts to the
problem a while back... I think.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "A generation which ignores history  |
|       aka Fighteer I       | has no past--and no future."         |
|   mailto:fighteer AT cs DOT com   |                                      |
| http://www.cs.com/fighteer |                - Lazarus Long        |
---------------------------------------------------------------------

- Raw text -


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