Skip to main content
Topic: GCC ****istance requested (Read 3230 times) previous topic - next topic

GCC ****istance requested

Having some trouble getting Simutrans-Experimental 7.1 to compile in Linux (using Ansgar's automated nightly builds - the master branch on Github, rather than the devel branch). The latest error messages are as follows:

Code: [Select]
simconvoi.cc:2805: error: conversion from 'ware_t*' to non-scalar type 'slist_tpl<ware_t>::iterator' requested
simconvoi.cc:2806: error: conversion from 'ware_t*' to non-scalar type 'slist_tpl<ware_t>::iterator' requested
simconvoi.cc:2812: error: 'cl**** vector_tpl<ware_t>' has no member named 'insert'

in respect of the following code that compiles without error in Windows (MSVC++):

Code: [Select]
for(i=0;  i<warenbauer_t::get_waren_anzahl();  i++  ) {
if(max_loaded_waren[i]>0  &&  i!=warenbauer_t::INDEX_NONE) {
ware_t ware(warenbauer_t::get_info(i));
ware.menge = max_loaded_waren[i];
if(ware.get_catg()==0) {
capacity.append( ware );
} else {
// append to category?
slist_tpl<ware_t>::iterator j = capacity.begin();
slist_tpl<ware_t>::iterator end = capacity.end();
while (j != end && j->get_catg() < ware.get_catg()) ++j;
if (j != end && j->get_catg() == ware.get_catg()) {
j->menge += max_loaded_waren[i];
} else {
// not yet there
capacity.insert(j, ware);
}
}
}
}

For reference, this line:

Code: [Select]
slist_tpl<ware_t>::iterator j = capacity.begin();

is line no. 2805. I do not understand how these errors relate to the code (both types are the same), and, at line 2812, "capacity" is an slist_tpl, not a vector, so the error makes no sense. I should be extremely grateful for any ****istance.
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.

Re: GCC ****istance requested

Reply #1
Has Ansgar added "-DSLIST_FREIGHT" to the declaration of FLAGS in config.default (which is based on config.template)?

Re: GCC ****istance requested

Reply #2
Hmm, I don't know...

What I do know is that it did not have this error in version 7.0, and I don't think that this part of the code has changed since then.
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.

Re: GCC ****istance requested

Reply #3
It is not very likely that the compiler will misinterpret the object types, so it seems to me that SLIST_FREIGHT has not been defined. You have SLIST_FREIGHT defined in your MSVC project file, but that will not be automatically transfered to the makefiles.

Have you informed Ansgar before that SLIST_FREIGHT has to be defined?

[Edit 1]

The 3 lines that cause errors will cause compilation failure if SLIST_FREIGHT is undefined, as they are exclusively for the case when the freight list uses slist_tpl. According to your previous practice, there should be conditional code blocks, one for slist_tpl and another for vector_tpl.

[Edit 2]

Running a GIT blame reveals that part of the code block above was added by Prissi when he first integrated network mode code into the trunk. Such code was added to EXP when you merged changes from the trunk after v7.0. But you weren't aware of that, and thus there are no conditional code blocks for slist_tpl and vector_tpl respectively.

And my guess is, Ansgar, without knowing that SLIST_FREIGHT has to be defined in config.default, has always been compiling Linux versions that use vector_tpl for freight list.

Re: GCC ****istance requested

Reply #4
Knightly,

thank you very much for your diagnostics! Most helpful. I am now staying with my parents for Christmas, and away from the computer on which I have the code, so I can't fix this now. However, I have sent a message to Ansgar asking him to define SLIST_FREIGHT so that we can get 7.1 out for Linux sooner rather than later. Thank you again for your help!
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.