[Headache] Can`t build GDExtension with Godot 4.4
Godot version
4.4 stable
godot-cpp version
4.4
System information
Windows11
Issue description
- Difficulty Locating Header Files in godot-cpp It's not that I can't find it, it's that the path is annoying It is cumbersome to locate specific header files within the godot-cpp, especially when configuring include paths in Visual Studio 2022. This often results in unresolved external symbol errors due to missing or incorrectly specified headers.
- Insufficient Documentation The official documentation lacks comprehensive guidance on key aspects such as: Proper project setup with Visual Studio 2022 Detailed explanation of GDExtension API Best practices for Variant type handling Character encoding configuration
- Frequent Errors in GDExtensionInitialize The GDExtensionInitialize function often fails with cryptic error messages, including: GDEXTENSION_INITIALIZATION_FAILED Undefined symbol errors related to initialization functions
- Character Encoding Issues Source files containing non-ASCII characters (e.g., comments or string literals) may exhibit encoding corruption, leading to: Compilation errors Runtime crashes when accessing misencoded strings
- Version Compatibility Issues Inconsistencies between godot-cpp, Godot Engine, and GDExtension API versions cause subtle but critical compatibility issues, such as: Function signature mismatches Missing or deprecated API features Incompatible Variant conversion behavior
- Variant Type Conversion Exceptions Unexpected exceptions occur during Variant type conversions, particularly when: Converting between complex types (e.g., Dictionary to custom object) Handling null or uninitialized Variant values Using Variant with custom GDExtension classes
Steps to reproduce
- Header File Location Issue Create a new GDExtension project in Visual Studio 2022 Attempt to include common headers (e.g., .../.../node.hpp) Guess what, which header files start with ‘gd’? Which ones don't? Guess if it's .h or .hpp?
- Documentation Deficiency Refer to the official godot-cpp documentation Attempt to find guidance on: Configuring Visual Studio 2022 for godot-cpp Advanced GDExtension initialization patterns Safe Variant type conversion practices
- GDExtensionInitialize Errors Implement a basic GDExtension with GDExtensionInitialize Build and load the extension in Godot Engine Observe initialization failures with error messages like: ERROR: initialize_library: GDExtension initialization failed.
- Character Encoding Problems Create a C++ source file with non-ASCII characters (e.g., Chinese/Japanese comments) Build the project in Visual Studio 2022 Observe compilation errors or runtime string corruption
- Version Compatibility Use godot-cpp-4.4 with Godot Engine 4.4-stable Implement a GDExtension using deprecated API features Observe runtime crashes or undefined behavior
- Variant Conversion Exceptions Write code to convert a Variant Dictionary to a custom object Trigger conversion with missing or invalid keys
Minimal reproduction project
System Configuration: OS: Windows 11 Godot Engine Version: 4.4-stable godot-cpp Version: 4.4 Visual Studio: 2022 (17.5.5) Compiler: MSVC 14.35.32215
In terms of experience, directly modifying the engine code in VS2022 is clearer and more convenient than using Godot-cpp to develop GDExtension plugins, kidding?
Maybe I'm not smart enough, and if someone can provide an answer, I'd be very grateful
I totally sympathise with the frustration, I just dont see how an issue like this is able to be worked on as a grab bag of under-specified issues. My suggestion is that you take each of these points, create an individual test project for each of them( perhaps pick th emost urgent first), try your luck in the forums and discord by posting the exact errors you are getting and show your code. And then if you have no luck re-submit them individually showing your work, projects, error messages etc. I'm sure that you will be able to overcome the problems if you tackle each case one by one.
Maybe I'm not smart enough
Never count yourself out. You don't know how the universe will unfold