Open danielvmacedo opened 4 years ago
Hello @danielvmacedo, you could also be interested in this other issue.
@danielvmacedo I had the same issue, and I found that if I did a scons build from the "x64 Native Tools Command Prompt for VS2019" the link errors went away.
You see, the issue is with cl.exe itself. There are different builds of cl.exe for different architectures: x86, arm, x64 etc. I found that if I did "where cl.exe" in my prompt window I had a x86 build of cl.exe. But the gdnative examples are built for x64. I believe that if you build with x86 cl.exe you get different mangled signatures for functions than if you link with x64 cl.exe, and this causes link errors.
Try using the x64 native tools prompt and see if that resolves the issue.
It's also lacking support for ARM64 for macOS.
We should generally avoid including full scripts in the documentation as they tend to grow stable. We should link to those scripts on properly maintained and branched Git repositories (demos, etc.).
For this tutorial, the SConstruct in https://github.com/godotengine/godot-cpp/tree/3.x can be used as a reference.
I think the tutorial at https://docs.godotengine.org/en/3.2/tutorials/plugins/gdnative/gdnative-cpp-example.html have a problem in the section "Compiling the plugin". The SConstruct file provided is giving me linking problems also reported by this user: https://godotengine.org/qa/64822/trouble-with-the-gdnative-c-example-from-the-documentation
However, I got it working using a modified version of the SConstruct file provided by this project: https://github.com/ProggerParrot/Godot-CppProject-Template
Best Regards,
Daniel