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

Fix GDExtension build error: incomplete type 'godot::Variant' #730

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nordup
Copy link

@Nordup Nordup commented Feb 12, 2025

I was getting this error while compiling GDExtension

In file included from generators/graph/voxel_generator_graph.h:7,
                 from generators/graph/voxel_generator_graph.cpp:1:
generators/graph/../../util/godot/core/dictionary.h: In function 'bool zylann::godot::try_get(const godot::Dictionary&, const godot::Variant&, T&)':
generators/graph/../../util/godot/core/dictionary.h:26:17: error: 'v' has incomplete type
   26 |         Variant v = d.get(key, Variant());
      |                 ^
In file included from generators/graph/../../util/godot/core/dictionary.h:7:
godot-cpp/gen/include/godot_cpp/variant/dictionary.hpp:43:7: note: forward declaration of 'class godot::Variant'
   43 | class Variant;
      |       ^~~~~~~
generators/graph/../../util/godot/core/dictionary.h:29:38: error: incomplete type 'godot::Variant' used in nested name specifier
   29 |         if (v.get_type() == Variant::NIL) {
      |                                      ^~~

Suggesting that Variant type is only forward declared in dictionary.hpp, but does not include its full definition.

@Zylann
Copy link
Owner

Zylann commented Feb 12, 2025

In this case I would probably move the try_get function implementation to a cpp file then. If Variant is forward-declared, I think it should remain so to avoid including Variant in all other headers that would not need its definition.

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

Successfully merging this pull request may close these issues.

2 participants