The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: wmoran on July 25, 2009, 12:08:03 pm

Title: Can't compile under FreeBSD
Post by: wmoran on July 25, 2009, 12:08:03 pm

Just grabbed the latest SVN and am unable to compile (note, I'm using gmake):

[...]
===> CXX bauer/warenbauer.cc
In file included from bauer/../simware.h:5,
                 from bauer/warenbauer.cc:11:
bauer/../dataobj/koord.h: In function 'uint32 koord_distance(const koord&, const koord&)':
bauer/../dataobj/koord.h:74: error: 'abs' was not declared in this scope
bauer/warenbauer.cc: In static member function 'static bool warenbauer_t::register_besch(ware_besch_t*)':
bauer/warenbauer.cc:121: warning: cast from type 'const ware_besch_t* const' to type 'ware_besch_t*' casts away constness
gmake: *** [bauer/warenbauer.o] Error 1

Having a look at koord.h, it seems as if the abs() calls are the problem.  Maybe I'm forgetting my C++, but is it proper to define function bodies in a header file?

It's been a while since I've tried to recompile this, so I'm not sure how long the problem has existed.
Title: Re: Can't compile under FreeBSD
Post by: prissi on July 25, 2009, 08:05:06 pm
aparently different distributions have their standard definitions at different places. Include math.h (probably) into koord.h should fix this.
Title: Re: Can't compile under FreeBSD
Post by: Hanczar on July 26, 2009, 08:07:42 pm
I have the same problem on Ubuntu 9.04 32-bit, gcc 4.3.3, including <math.h> doesn't help.
After googling adding <cstdlib> resolves problem for me.
Title: Re: Can't compile under FreeBSD
Post by: gerw on July 27, 2009, 07:44:06 am
I have the same problem on Ubuntu 9.04 32-bit, gcc 4.3.3, including <math.h> doesn't help.
After googling adding <cstdlib> resolves problem for me.
Did you compile without DEBUG? If you compile with DEBUG, cstdlib get's included via simtypes.h.
I've observed the same and posted it in an other thread (http://forum.simutrans.com/index.php?topic=2526.0 (http://forum.simutrans.com/index.php?topic=2526.0)).