• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] hash_map deprecated error when trying to compile OregonCore

Status
Not open for further replies.

kemkoi

Sexy Member
Hello, I'm trying to compile the latest OregonCore version in Visual Studio Community 2015 with Update 2. Before you start asking me if I've installed all the software required I should let you know I have and that I followed the guide they have in their documentation. The problem lays in their code, I'm almost certain about that. So on to the problem then, whenever I try to compile the "ALL_BUILD" in the project I've generated with cmake it goes on for a while and then I get the following error messages:

Code:
D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\tools\movements_extractor\VMapExtensions.cpp)
23>  PatchHandler.cpp
23>  RealmList.cpp
23>  WheatyExceptionReport.cpp
23>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregonrealm\Console.cpp)
23>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregonrealm\AuthSocket.cpp)
20>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\tools\movements_extractor\TerrainBuilder.cpp)
23>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregonrealm\Main.cpp)
23>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp)
23>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregonrealm\RealmList.cpp)
20>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\tools\movements_extractor\generator.cpp)
20>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\tools\movements_extractor\MapBuilder.cpp)
22>  Console.cpp
22>  Main.cpp
22>  Master.cpp
23>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregonrealm\PatchHandler.cpp)
22>  OCSoap.cpp
22>  RARunnable.cpp
22>  RASocket.cpp
23>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1544): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp)
22>  WorldRunnable.cpp
23>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3190): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp)
23>D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp(1338): warning C4477: 'sprintf' : format string '%X' requires an argument of type 'unsigned int', but variadic argument 1 has type 'PDWORD'
23>D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp(1349): warning C4477: 'sprintf' : format string '%X' requires an argument of type 'unsigned int', but variadic argument 1 has type 'PDWORD'
22>  WheatyExceptionReport.cpp
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregoncore\Main.cpp)
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregoncore\Console.cpp)
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregoncore\OCSoap.cpp)
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregoncore\RASocket.cpp)
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregoncore\RARunnable.cpp)
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregoncore\Master.cpp)
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\oregoncore\WorldRunnable.cpp)
22>D:\Programs\Visual Studio\VC\include\hash_map(17): error C2338: <hash_map> is deprecated and will be REMOVED. Please use <unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp)
21>LINK : fatal error LNK1181: cannot open input file '..\..\collision\Release\collision.lib'
22>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1544): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp)
22>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3190): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp)
22>D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp(1338): warning C4477: 'sprintf' : format string '%X' requires an argument of type 'unsigned int', but variadic argument 1 has type 'PDWORD'
22>D:\MJOC Server\src\shared\Debugging\WheatyExceptionReport.cpp(1349): warning C4477: 'sprintf' : format string '%X' requires an argument of type 'unsigned int', but variadic argument 1 has type 'PDWORD'
24>------ Build started: Project: ALL_BUILD, Configuration: Release Win32 ------
24>  Building Custom Rule D:/MJOC Server/CMakeLists.txt
24>  CMake does not need to re-run because D:\build\CMakeFiles\generate.stamp is up-to-date.
========== Build: 15 succeeded, 9 failed, 0 up-to-date, 0 skipped ==========

I read up on it and obviously hash_map is deprecated and might get removed in the near future. I want to change it to an unordered_map or at least define the error so it gets ignored but I can't even seem to find anything that has to do with a hash map in the files other than this line in the PatchHandler.cpp file:

Code:
// Store the result in the internal patch hash map
    patches_[path] = new PATCH_INFO;
    MD5_Final((ACE_UINT8*) & patches_[path]->md5, &ctx);

I'm not very experienced in c++ because I've mostly programmed in Java so I don't really understand what there is I need to change in order for the project to successfully compile. Would appriciate if anyone could enlighten me about this issue.
 

Rochet2

Moderator / Eluna Dev
It is possible the source does not support newer compilers (VS 2015 update 2 is very recent)
You should post the errors to the devs (to their issue tracker for example).
Otherwise you can try to use an older VS or try to define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS or change hash_map to unordered_map everywhere in the code like the error says.

As you say, it looks like the replacing is not possible. The error comes likely through some includes.
I think the problem might be here
https://github.com/OregonCore/Orego...rc/framework/Utilities/UnorderedMap.h#L36-L50
Some of the definitions that define to use std::hash_map are in use instead of std::unordered_map

You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS in cmake by doing add_definitions(-D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS ) in some of the top level CMakeLists.txt files, like the one in root folder.
 
Last edited:

kemkoi

Sexy Member
Alright so I added the define into the CMakeLists.txt file in the /src folder and remade the cmake process and tried to comile again. This time It did not give me any errors about the hash_map but instead it gave me the following error:

Code:
Error	C1189	#error:  Macro definition of snprintf conflicts with Standard Library function declaration (compiling source file D:\MJOC Server\dep\mysqllite\libmysql\get_password.c)	libmysql	C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h	1927

Apparently you don't need to define _snprintf anymore, so should I just delete them or what?
 

Rochet2

Moderator / Eluna Dev
Try removing the cmake change you made.
Open up the file I linked and change all hash_map to unordered_map in it.

Then try compiling again.
 

kemkoi

Sexy Member
That just made it worse, about 1600 errors after changing everything from hash_map to unordered_map in the UnorderedMap.h file. I guess I should just downgrade to another version of Visual Studio maybe? Or do you think that'll still give me the same issues?
 
Status
Not open for further replies.
Top