News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Serious compilation bugs (fixed)

Started by neroden, December 05, 2011, 04:48:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neroden

Your 10.x branch doesn't compile with GCC under Linux, and as a result neither do any of your other branches.

The recurring problem is that you are taking addresses of temporaries, which is prohibited.

I fixed one of these problems (in vehicle/simvehikel.c) correctly. 

You should not be passing koord3d by pointer in any case; passing it by value should be sufficiently efficient with optimizing compilation; if you don't like passing it by value, pass it by reference.  There's a rule of thumb; once you put a pointer into a method signature, you're stuck forever, and it becomes impossible to pass raw data to the method without using a global or static variable -- so don't do it unless that's acceptable (if the method is operating on pointer-based data structures, for instance, and can't accept raw data anyway).

I fixed the other problem, in  simhalt.cc, with brute force, removing a sanity check, because I couldn't figure out what you were doing; the types were perplexing.  But hey, it compiles now.

Please pull from my jp-10x branch, which constains these crucial fixes.  (Then look at simhalt.cc and figure out what you were trying to do, and do it without taking the address of a temporary.)

P.S. I won't be able to work on simutrans much because I'm learning calculus of variations, but at least I can keep it compiling.  :-)

Dwachs

Quote from: neroden on December 05, 2011, 04:48:15 AM
P.S. I won't be able to work on simutrans much because I'm learning calculus of variations, but at least I can keep it compiling.  :-)
Don't trust Dirichlet's principle !!!!!!

jamespetts

Nathaneal,

thank you very much for this - I have incorporated this as suggested. Can you test to see whether my running-powers branch compiles properly on Linux now? Thank you again!