delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/23/00:47:41

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp,rec.games.programmer
Subject: Re: declaring/passing ptrs to @D arrays
Date: Tue, 22 Jul 1997 19:20:54 -0700
Organization: Alcyone Systems
Lines: 49
Message-ID: <33D56A86.57FBE05F@alcyone.com>
References: <33D10773 DOT 45C94A8D AT gapeach DOT com>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jacob Martin wrote:

> how do I do this?  I keep getting bad comilation stuff....
> 
> I thought I had it right, then I started the whole..."hmmm, add another
> star?hmmm remove a star...hmmm"

This is not the right way to become a good programmer.  This is the way to
become someone who programs by trial and error.

> and I finally got it to compile( halfway) but it gives me this:
> 
> E:\game>gxx test.cc -lj -lm
> e:/djgpp/tmp\ccdaaaaa(.text+0xc0):test.cc: undefined reference to
> `mapmaker(int
> *, int)'
> e:/djgpp/tmp\ccdaaaaa(.text+0x170):test.cc: undefined reference to
> `frenchtile(i
> nt *, buffer_rec *, bufinde *, int)'
> 
> Here's the relevant  code...

These functions are declared as:

> void frenchtile(int *,buffer_rec *bufferptr,bufinde *btp, int);
> void mapmaker (int *,int) ;

But they're defined as:

> void frenchtile(int **mmp,buffer_rec *bufferptr,bufinde *btp,int page)
	...
> void mapmaker (int **mmp, int size)  {
	...

The prototypes do not match the declared functions.  Since this is C++
(you're using the .cc extension), you can have overloaded functions, where
multiple functions have the same identifier but different arguments.
You're prototyping two functions, each of which starts with an int *, but
then you're declaring them as taking int **.  In C++ this is not an error
(in C it is), but you're clearly using the int *-using functions elsewhere
and there are no such functions declared.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
   "Love is not love which alters / when it alternation finds."
                                 / William Shakespeare, _Sonnets_, 116

- Raw text -


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