godotengine / godotengine/godot-cpp

[Headache] Can`t build GDExtension with Godot 4.4

Open
#1,793 2 comments 0 reactions 0 assignees View on GitHub
bug documentation topic:buildsystem
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

### Godot version

4.4 stable

### godot-cpp version

4.4

### System information

Windows11

### Issue description

1. 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.
2. 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
3. Frequent Errors in GDExtensionInitialize
The GDExtensionInitialize function often fails with cryptic error messages, including:
GDEXTENSION_INITIALIZATION_FAILED
Undefined symbol errors related to initialization functions
4. 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
5. 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
6. 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

1. 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?
2. 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
3. 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.
4. 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
5. 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
6. 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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.