delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/20/07:02:19

From: "Russ Williams" <russ AT algorithm DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp,rec.games.programmer
Subject: Re: declaring/passing ptrs to @D arrays
Date: Sun, 20 Jul 1997 09:58:31 GMT
Message-ID: <01bc94f3$a22308a0$b756dec2@algorithm>
References: <33D10773 DOT 45C94A8D AT gapeach DOT com>
NNTP-Posting-Host: algorithm.demon.co.uk
Lines: 41
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jacob Martin <jake AT gapeach DOT com> wrote in article
<33D10773 DOT 45C94A8D AT gapeach DOT com>...
> 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"
> 
> 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...
> 
> void frenchtile(int *,buffer_rec *bufferptr,bufinde *btp, int);
> void mapmaker (int *,int) ;
[...]
> void frenchtile(int **mmp,buffer_rec *bufferptr,bufinde *btp,int page)
[...]
> void mapmaker (int **mmp, int size)  {

The problem is that you're using C++ ;). If you compiled that code as C,
the compiler would shout at you for passing int * to a function that wants
int **. C++ allows multiple definitions for a given function, with
different parameter types, so it compiles and then tries to link to the
mapmaker (int **,int) function, which doesn't exist...

[...]
> Thanks...
> 
No problem.

---
Russ


- Raw text -


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