I should be very grateful if anyone could help me to resolve a difficulty that I have encountered with compiling Makeobj on the -devel branch. I get the following error generated, ultimately, I think, by vehicle_writer.cc:
1>vehicle_writer.obj : error LNK2001: unresolved external symbol "public: __thiscall slist_tpl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::slist_tpl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(class slist_tpl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > const &)"(??0?$slist_tpl@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE@ABV0@@Z)
I am not sure quite what #includes are missing, since slist_tpl.h is included, and I have a using std::string directive. Adding #include<string> made no difference.
Any assistance would be much appreciated!
a copy-constructor for slist_tpl<whatever> is missing. My guess: this error comes from such lines:
liverykeys_empty.append(slist_tpl<string>());
You have to replace this by just
liverykeys_empty.append( );
It will do exactly the same.
Thank you very much - that worked!
Hmm - it seems that I spoke too soon: the automated compiler is still giving me the following error from the master branch:
===> LD ../build/simutrans-exp/makeobj/makeobj
../build/simutrans-exp/besch/writer/vehicle_writer-makeobj.o: In function `node_t':
/home/simutrans/simutrans-exp/makeobj/../besch/writer/../../dataobj/../tpl/slist_tpl.h:42: undefined reference to `slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::slist_tpl(slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)'
/home/simutrans/simutrans-exp/makeobj/../besch/writer/../../dataobj/../tpl/slist_tpl.h:42: undefined reference to `slist_tpl<slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::slist_tpl(slist_tpl<slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
/home/simutrans/simutrans-exp/makeobj/../besch/writer/../../dataobj/../tpl/slist_tpl.h:42: undefined reference to `slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::slist_tpl(slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)'
/home/simutrans/simutrans-exp/makeobj/../besch/writer/../../dataobj/../tpl/slist_tpl.h:42: undefined reference to `slist_tpl<slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::slist_tpl(slist_tpl<slist_tpl<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
collect2: ld returned 1 exit status
make: *** [../build/simutrans-exp/makeobj/makeobj] Error 1
make: Leaving directory `/home/simutrans/simutrans-exp/makeobj'
Any assistance would be appreciated!
In your master branch you still have stuff like
liverykeys_freight.append(slist_tpl<slist_tpl<string> >());
which seems to be fixed already on the other branch....
Please revert this change:
https://github.com/jamespetts/simutrans-experimental/commit/1d9e3733cd8b0a2223508f8edfc6c2b681eb9c94
It only obfuscates error messages, as these come now from the linker not the compiler.
Edit: I am quite certain that you should insert
liverykeys_freight.at(i).append()
before the loop
for(int freight = 0; freight < freight_max; freight++)
Thank you for that - that is most helpful! May I ask - there are two instances of:
for(int freight = 0; freight < freight_max; freight++)
To which were you referring when you wrote that I need to insert
liverykeys_freight.at(i).append()
before it?
I was referring to the nested loops that modify liverykeys_freight. Imho you have to insert liverykeys_freight.at(i).append() before line 387 in vehivle_writer.cc