hash_map error when compiling Exult 1.2

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Raphael

hash_map error when compiling Exult 1.2

Post by Raphael »

Hi,

compiling exult 1.2 on SUSE 10.3 linux I get a "'std::hash_map' has not been declared" error. AFAIK standard C++ does not provide a hash_map container. Is there a special library I have to install? And why is hash_map declared in the std namespace?

g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../headers -I./.. -I./../files -I./../imagewin -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/freetype2 -DXWIN -O2 -Wno-long-long -g -O2 -c bodies.cc -MT bodies.lo -MD -MP -MF .deps/bodies.TPlo -o bodies.o
In file included from bodies.cc:26:
../hash_utils.h:32: error: 'std::hash_map' has not been declared
In file included from bodies.cc:26:
../hash_utils.h:50: error: 'std::hash_set' has not been declared
In file included from bodies.cc:27:
../game.h:60: error: ISO C++ forbids declaration of 'hash_map' with no type
../game.h:60: error: expected ';' before '<' token
../game.h:61: error: ISO C++ forbids declaration of 'hash_map' with no type
../game.h:61: error: expected ';' before '<' token
bodies.cc: In static member function 'static int Body_lookup::find(int, int&, int&)':
bodies.cc:424: error: expected initializer before '<' token
bodies.cc:429: error: 'htable' was not declared in this scope
bodies.cc:432: error: expected type-specifier before 'hash_set'
bodies.cc:432: error: expected `;' before 'hash_set'
bodies.cc:456: error: 'hash_set' was not declared in this scope
bodies.cc:456: error: expected primary-expression before 'short'
bodies.cc:456: error: expected `;' before 'short'
bodies.cc:461: error: 'it' was not declared in this scope
bodies.cc:461: error: 'htable' was not declared in this scope
make[2]: *** [bodies.lo] Error 1
make[2]: Leaving directory `/home/raphael/software/exult-1.2/shapes'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/raphael/software/exult-1.2'
make: *** [all] Error 2
Raphael

Re: hash_map error when compiling Exult 1.2

Post by Raphael »

Solved. In "hash_utils.h" "__GNUC__== 3" had to be replaced by "__GNUC__>= 3".

After that I got the error "../../mouse.h:37: error: ISO C++ forbids declaration of 'Game_window' with no type"

I solved that by adding "gamewin.h" to the includes of "mouse.h" and afterwards in "gamewin.h" I hat to change #include "flags.h" to
#include "objs/flags.h"

And in "audio/midi_drivers/fmopldrv.h" "void OplDriver::send(uint32 b);" had to be replaced by "void send(uint32 b);"

In "usecode/ucxt/include/ucfunc.h" "std::ostream &UCFunc::output_ucs_funcname(std::ostream &o, const FuncMap &funcmap);" had to be changed to "std::ostream &output_ucs_funcname(std::ostream &o, const FuncMap &funcmap);"

And finally in "usecode/useval.cc" I had to replace "Write4(ptr, (int)value.ptr);" by "Write4(ptr, (long)value.ptr);" - I have x86_64 architecture.

With these changes Exult 1.2 compiled with gcc 4.2.1 on SUSE 10.3 x86_64. I just wonder how anyone could ever compile the tarball:-)
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: hash_map error when compiling Exult 1.2

Post by Dominus »

With these changes Exult 1.2 compiled with gcc 4.2.1 on SUSE 10.3 x86_64. I just wonder how anyone could ever compile the tarball:-)
I guess back when 1.2 was released there was still gcc 3.x the newest which didn't throw these errors. But who knows :)
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: hash_map error when compiling Exult 1.2

Post by drcode »

We ought to get rid of the use of hash_map. I might do that tomorrow.
Robin Norwood

Re: hash_map error when compiling Exult 1.2

Post by Robin Norwood »

fwiw, I just posted a spec file and srpm for Fedora 7. The spec file includes patches that fix all of the build errors I encountered, and are probably relevant to Suse as well.

http://people.redhat.com/rnorwood/rpms/PackageKit.spec
http://people.redhat.com/rnorwood/rpms/ ... -2.src.rpm

For reference, here are the patches:

http://people.redhat.com/rnorwood/rpms/ ... -Xft.patch
http://people.redhat.com/rnorwood/rpms/ ... -gcc.patch

-RN
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: hash_map error when compiling Exult 1.2

Post by drcode »

Thanks!
Locked