Re: -Crawl- Compiling 4.1a
- From: Darshan Shaligram <scintilla@xxxxxxxxx>
- Date: Mon, 25 Jul 2005 17:46:30 +0530
"Erik Piper" <erik@xxxxxx> writes:
> Darshan Shaligram wrote:
>> "Erik Piper" <erik@xxxxxx> writes:
>> > Error E2268 effects.cc 762: Call to undefined function 'tolower' in
>> > function acquirement(unsigned char,bool)
>> Put in a
>> #include <ctype.h>
>> along with the other #includes.
> Worked. (Also had to be done elsewhere.) Is there a simple "why" for
> this so that I might learn something from the incident?
Sure. The error was caused by the C++ compiler seeing a function call
to the unknown function 'tolower'. The compiler doesn't like unknown
functions, so you need to tell it what the function looks like by
saying (for instance):
int tolower(int);
in effects.cc. That's called a function prototype.
Now, 'tolower' happens to be a standard C function, which means the
compiler writer already did the work of writing all those tiresome
prototypes. In the case of 'tolower', the prototype is in the header
file ctype.h. #including it keeps the compiler happy.
> More importantly, if I might ask for help again... now it's barfing on
> itemprop.cc:
> Error E2232 itemprop.cc 50: Constant member 'armour_def::name' in class
> without constructors
> Error E2232 itemprop.cc 162: Constant member 'weapon_def::name' in
> class without constructors
> Error E2232 itemprop.cc 341: Constant member 'missile_def::name' in
> class without constructors
> Error E2232 itemprop.cc 363: Constant member 'food_def::name' in class
> without constructors
You probably need to change:
struct armour_def
{
armour_type id;
const char name[ITEMNAME_SIZE];
to
struct armour_def
{
armour_type id;
const char *name;
And do the same for weapon_def, missile_def, and food_def. It's
unclear to me why name was defined as a char array at all for those
structs.
--
Darshan Shaligram <scintilla@xxxxxxxxx> Deus vult
.
- Follow-Ups:
- Re: -Crawl- Compiling 4.1a
- From: Erik Piper
- Re: -Crawl- Compiling 4.1a
- References:
- -Crawl- Compiling 4.1a
- From: Erik Piper
- Re: -Crawl- Compiling 4.1a
- From: Darshan Shaligram
- Re: -Crawl- Compiling 4.1a
- From: Erik Piper
- -Crawl- Compiling 4.1a
- Prev by Date: Re: -Crawl- Compiling 4.1a
- Next by Date: -Crawl- Random discoveries in the 4.1a source
- Previous by thread: Re: -Crawl- Compiling 4.1a
- Next by thread: Re: -Crawl- Compiling 4.1a
- Index(es):
Relevant Pages
|