Skip to main content
Topic: Request for ****istance - bizarre error on merge (Read 6336 times) previous topic - next topic

Request for ****istance - bizarre error on merge

After merging the latest changes to Standard, including the climate settings in the "settings" menu, I get some bizarre Alice in Wonderland like errors that go like this:

Code: [Select]
1>gui\settings_stats.cc(671): error C2385: ambiguous access of 'add_komponente'
1>          could be the 'add_komponente' in base 'gui_container_t'
1>          or could be the 'add_komponente' in base 'gui_container_t'

I would understand the error if the two things to which the line refers were different, but they're exactly the same, so I am unclear as to where the ambiguity comes from. I have checked to see whether this is an issue that equally affects Standard, but Standard compiles fine. I am a little stuck - does anyone have any suggestions? The broken code is on -devel. Thank you in advance!
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: Request for ****istance - bizarre error on merge

Reply #1
I had problems like this before.  It's most likely *linker error*.  Make sure each .cc file is listed exactly once in the Makefile variable SOURCES -- if any file is listed twice, this is the error which results.  (EDIT: of course you're using Microsoft, so find the comparable list of source files.  Make sure nothing is being compiled twice.)

If that's not the problem, then the problem is most likely multiple inheritance: some cl**** is inheriting from gui_container_t *twice* and the two different copies are fighting.  In that case, track back through the ancestry tree and eliminate the duplicate inheritance reference.

If you can't eliminate the duplicate inheritance (for instance, if A inherits from B and C, and B and C each inherit from gui_container_t separately, the 'diamond pattern'), then you have to make sure that gui_container_t is a *virtual base cl***** -- it's probably become non-virtual for some reason.

Re: Request for ****istance - bizarre error on merge

Reply #2
Please note that standard doesn't currently compile on gcc; the climate settings patch introduced a failure-to-compile bug.  I'm currently debugging that and once I fix it I may be able to help debug the merge.

Re: Request for ****istance - bizarre error on merge

Reply #3
Nathaneal,

thank you very much for your help with this. I have been somewhat too tired to work on this to-day, but think that these warnings might be relevant, given what you wrote above:

Code: [Select]

1>f:\my documents\development\simutrans\simutrans-experimental-sources\gui\gui_container.h(79): warning C4091: 'virtual ' : ignored on left of 'gui_container_t' when no variable is declared
1>f:\my documents\development\simutrans\simutrans-experimental-sources\gui\settings_stats.h(209): warning C4584: 'settings_climates_stats_t' : base-cl**** 'gui_container_t' is already a base-cl**** of 'settings_stats_t'
1>          f:\my documents\development\simutrans\simutrans-experimental-sources\gui\gui_container.h(24) : see declaration of 'gui_container_t'
1>          f:\my documents\development\simutrans\simutrans-experimental-sources\gui\settings_stats.h(133) : see declaration of 'settings_stats_t'
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: Request for ****istance - bizarre error on merge

Reply #4
Nathaneal,

thank you very much for your help with this. I have been somewhat too tired to work on this to-day, but think that these warnings might be relevant, given what you wrote above:

Code: [Select]

1>f:\my documents\development\simutrans\simutrans-experimental-sources\gui\gui_container.h(79): warning C4091: 'virtual ' : ignored on left of 'gui_container_t' when no variable is declared
1>f:\my documents\development\simutrans\simutrans-experimental-sources\gui\settings_stats.h(209): warning C4584: 'settings_climates_stats_t' : base-cl**** 'gui_container_t' is already a base-cl**** of 'settings_stats_t'
1>          f:\my documents\development\simutrans\simutrans-experimental-sources\gui\gui_container.h(24) : see declaration of 'gui_container_t'
1>          f:\my documents\development\simutrans\simutrans-experimental-sources\gui\settings_stats.h(133) : see declaration of 'settings_stats_t'

Bingo.

The reason standard is working is that gui_container_t is *not* a public base cl**** of settings_stats_t in standard.

Bernd caused settings_stats_t to inherit from gui_container_t in experimental.

It's all related to this commit from Bernd:
http://github.com/neroden/simutrans/commit/13c4b9ffaec79f50f63847ce4a0752de4c758957

You have to apply the same change to the new cl**** settings_climate_stats_t which Bernd already applied to all the previously existing similar cl****es.  Replace this line in settings_stats.h:
Code: [Select]
cl**** settings_climates_stats_t : protected settings_stats_t, public gui_container_t, public action_listener_t
with this:
Code: [Select]
cl**** settings_climates_stats_t : public settings_stats_t, public action_listener_t

I'm betting that will do the trick.  But I haven't tested it yet. If you have any further problems don't hesitate to ask.  :-)

Re: Request for ****istance - bizarre error on merge

Reply #5
Ahh, thank you very much! That does help. Most kind.
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.