Skip to main content
Topic: [rev 2542] Compile problem on Linux (Read 3489 times) previous topic - next topic

[rev 2542] Compile problem on Linux

Hi!

Compiling rev2542 on gcc 4.3.1 and gcc 4.3.2 (openSUSE 11.0 + 11.1) I get the following error:
===> 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
make: *** [bauer/warenbauer.o] Error 1

Including stdlib.h in dataobj/koord.h solves the issue.

Best,

  Markus

Re: [rev 2542] Compile problem on Linux

Reply #1
You have to include stdlib in koord.h:
Code: [Select]
diff --git dataobj/koord.h dataobj/koord.h
index 6efc7b4..9928bf6 100644
--- dataobj/koord.h
+++ dataobj/koord.h
@@ -3,6 +3,7 @@
 
 #include "ribi.h"
 #include "../simtypes.h"
+#include <stdlib.h>
 
 cl**** loadsave_t;
(If you compile with the debug flag, stdlib will be included via simtypes and thus this bug wasn't spotted, yet).

Re: [rev 2542] Compile problem on Linux

Reply #2
Please compile your binaries anyway with DEBUG unless you have an extremely good reason not to do so!

Re: [rev 2542] Compile problem on Linux

Reply #3
I switch DEBUG on and off from time to time to see if it does any difference. So far it didn't. If you think this is wrong, I'll always use DEBUG going forward. It was more my curiosity.

Re: [rev 2542] Compile problem on Linux

Reply #4
Please compile your binaries anyway with DEBUG unless you have an extremely good reason not to do so!
Why should he do so? If I would be an ordinary player, I would also try to compile without DEBUG.

Re: [rev 2542] Compile problem on Linux

Reply #5
Because then I get reports like "Crashes at laoding without proper error message". All stable have Debug aktivated. Maybe, if you compile for a console or a mobile device, you can save 30kB withotu debug code. For everything else, debug is needed for us to help. Or you are knowing what you are doing.

Re: [rev 2542] Compile problem on Linux

Reply #6
In relation to recently opened thread:
http://forum.simutrans.com/index.php?topic=2831.0

I think that compilation problem when DEBUG is not defined in some random place with missing reference to standard library function don't tells good for everyone who download sources and try compile it.

So for me such scenarios looks ok in consideration of problems mentioned in previous posts:
a) define DEBUG is defined always , so it not need to enable it in configuration makefile, or in this makefile is note that it must be defined. ( But then this variable loss its sense )
b) compilation breaks with error some like this ("currently non-DEBUG builds are not supported") , not by random missing reference to function from standard library.

c) DEBUG is not needed, compilation without it is corrected.
+ optionaly the most important debug parts are moved outside debug variable, and code which can have influence on performance as sanity checks inside loops or something like this are kept only in debug builds.
+ optionaly info in title of window on nondebug builds meaning "crash reports from nondebugs builds are not respected and they are ignored ".

 

Re: [rev 2542] Compile problem on Linux

Reply #7
The Windows release builds of Simutrans-Experimental are always compiled with Debug off.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.