Skip to main content
Topic: Can't compile under FreeBSD (Read 2901 times) previous topic - next topic

Can't compile under FreeBSD


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.

Re: Can't compile under FreeBSD

Reply #1
aparently different distributions have their standard definitions at different places. Include math.h (probably) into koord.h should fix this.

Re: Can't compile under FreeBSD

Reply #2
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.

 

Re: Can't compile under FreeBSD

Reply #3
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).