ClassDB & D_METHOD not recognized by Visual Studio

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DelightLlama

I’m making a .dll for godot, so far everything work if I only receive values from .dll, but now I need to send values to the .dll from godot, but ClassDB and D_METHOD aren’t recognized by Visual Studio.

I’ve compiled the godot-cpp with headers generating the bindings and binaries, added the paths include, include/core, include/gen and the .libs in the project’s properties, but only when I try to include “class_db.h” and make use of ClassDB::bind_method(D_METHOD(“myMethod”, “argName”), &MYCustomClass::myMethod); Visual studio flags CLassDB and D_METHOD as undefined

I’ve tried including the path “C:\godot-3.2.2-stable\core” to the project properties but then other Classes are flagged as ambiguous if i try to rebuild the project.

What is the correct way to make use of ClassDB::bind_method in a visual studio project

Thank you.

:bust_in_silhouette: Reply From: sash-rc

My ClassDB doesn’t have method bind_method, nor I don’t get why do you need it.

What’s your exact task?

To “pass values” back and forth you have to use methods. You should register them to make callable by GDScript. Additionally you could register a property, by providing setter and getter. This will also make this property visible in Godot’s inspector.

Alternatively, you could simply get GDScript’s variable at C++ side with

Variant value = someNode->get("gdscript_var");