Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC Fails with Unordered_map #42

Closed
greenfire27 opened this issue May 17, 2022 · 4 comments
Closed

GCC Fails with Unordered_map #42

greenfire27 opened this issue May 17, 2022 · 4 comments

Comments

@greenfire27
Copy link
Collaborator

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

@dottools
Copy link
Contributor

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.

@dottools
Copy link
Contributor

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.

@dottools
Copy link
Contributor

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.

@elementc
Copy link
Contributor

elementc commented May 17, 2022

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.

elementc added a commit to elementc/Torque2D-1 that referenced this issue May 17, 2022
… sad inside of Torque2D's existing linux platform.

Bump Linux compile to -std=c++14 and optimization level from -O0 to -Og.

Fix a bug in guiMLTextCtrl stemming from the changes to 128750d.

Closes TorqueGameEngines#42.
elementc added a commit to elementc/Torque2D-1 that referenced this issue May 17, 2022
… sad inside of Torque2D's existing linux platform.

Bump Linux compile to -std=c++14 and optimization level from -O0 to -Og.

Fix a bug in types.gcc.h which uses the wrong capitalization of the LINUX symbol.

Fix a bug in guiMLTextCtrl stemming from the changes to 128750d.

Closes TorqueGameEngines#42.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants