GCC Fails with Unordered_map
greenfire27 opened this issue · 4 comments
The addition of an unordered map in GuiTypes.cc in a recent check-in has lead to the Makefile to error out.
In file included from /usr/include/c++/12.1.0/unordered_map:47,
from ../../source/gui/guiTypes.h:63,
from ../../source/gui/guiControl.h:42,
from ../../source/2d/editorToy/EditorToySceneWindow.h:5,
from ../../source/2d/editorToy/EditorToyTool.h:6,
from ../../source/2d/editorToy/EditorToyTool.cc:4:
/usr/include/c++/12.1.0/bits/unordered_map.h:40:37: error: ‘_Hashtable_traits’ in namespace ‘std::__detail’ does not name a template type
40 | using __umap_traits = __detail::_Hashtable_traits<_Cache, false, true>;
| ^~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
make: *** [Torque2D.mk:132: Debug/2d/editorToy/EditorToyTool.cc.o] Error 1
Best that I can tell is that you're not specifying at minimum C++11 via compiler options -std=c++11
or -std=gnu++11
. C++14 might even be warranted these days for improved constexpr
support.
What platform are you building for? I can't find a Torque2D.mk
file in this repository. Looks like all the compiler and IDE projects are using C++11.
OK I finally found Torque2D.mk
after looking in development
branch instead of master
.
The only thing I can suggest is moving #include <unordered_map>
up in the header file as the first include in guiTypes.h
in case the other header files are somehow fubaring include directives. And see what happens.
I spent a little time tonight trying my luck at tweaking configs to get this working.
I saw the same failure from this issue on -std=c++14
, and saw a new failure on -std=c++17
:
make: *** [Torque2D.mk:130: Debug/2d/gui/guiSpriteCtrl.cc.o] Error 1
In file included from ../../source/assets/assetManager.h:31,
from ../../source/assets/assetPtr.h:27,
from ../../source/2d/assets/AnimationAsset.h:27,
from ../../source/2d/core/ImageFrameProviderCore.h:31,
from ../../source/2d/core/ImageFrameProvider.h:27,
from ../../source/2d/core/ImageFrameProvider.cc:23:
../../source/persistence/taml/taml.h:88:13: error: 'HashMap' does not name a type
88 | typedef HashMap<SimObjectId, TamlWriteNode*> typeCompiledHash;
| ^~~~~~~
compilation terminated due to -Wfatal-errors.
Hilariously, in c++17
, our home-grown HashMap
implementation dies instead of the std::unordered_map
that's dying in gnu++11
and c++14
.
... but why do we need std::unordered_map
when we already have our own perfectly-good HashMap
class?
PR inbound.