godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.71k stars 573 forks source link

Can't load test project: `Attempt to get non-existent interface function: string_resize` #1201

Closed lowagner closed 1 year ago

lowagner commented 1 year ago

Godot version

4.1.stable.official.970459615

godot-cpp version

5834e16a221fde8dc0b6ca4b7a6721cc4b258037

System information

ubuntu 22.04 linux 5.19

Issue description

tried to build godot-cpp with scons, but get this error when trying to open the test project:

ERROR: Attempt to get non-existent interface function: string_resize
   at: get_interface_function (core/extension/gdextension.cpp:448)
ERROR: Unable to load GDExtension interface function string_resize()
   at: init (/$PARENT_DIRECTORY/godot-cpp/src/godot.cpp:315)
ERROR: GDExtension initialization function 'example_library_init' returned an error.
   at: open_library (core/extension/gdextension.cpp:476)
ERROR: Failed loading resource: res://example.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:273)

Steps to reproduce

make linux64 in the root directory

then scons in the test directory

then godot project.godot in the test/project directory.

Minimal reproduction project

N/A

AThousandShips commented 1 year ago

You're using the 4.2 version of godot-cpp, you need to use the 4.1.stable version for your godot branch version, they're not compatible, they need to match

AThousandShips commented 1 year ago

See also (duplicate?):

lowagner commented 1 year ago

yeah it's probably my fault: https://github.com/godotengine/godot-cpp/blob/5834e16a221fde8dc0b6ca4b7a6721cc4b258037/gdextension/gdextension_interface.h#L1531

i'll checkout the 4.1 branch.

akriegman commented 1 year ago

I had the same problem. It would be nice if this were reflected in the README. Right now it says:

Warning

This repository's master branch is only usable with the latest version of Godot's ([GDExtension](https://godotengine.org/article/introducing-gd-extensions)) API (Godot 4.1 and later).

For users of Godot 4.0.x, switch to the [4.0](https://github.com/godotengine/godot-cpp/tree/4.0) branch.

For GDNative users (Godot 3.x), switch to the [3.x](https://github.com/godotengine/godot-cpp/tree/3.x) or the [3.5](https://github.com/godotengine/godot-cpp/tree/3.5) branch.

Which makes it sound like I'm good to go to use the master branch with 4.1.