Custom C++ module

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kovalski
:warning: Old Version Published before Godot 3 was released.

Why my C++ module works in Godot itself, but when I compile an application, it does not work? It says that such class does not exist.

:bust_in_silhouette: Reply From: Zylann

Because when Godot exports a game, it uses another binary which doesn’t contain the editor and is compiled with optimizations. These binaries are in “export templates”, which you probably have installed before exporting.

You already compiled your module for the editor. What you have to do is to also compile it in the export template you are using. I never did that myself yet, but you may find more info about your problem is this previous question: https://forum.godotengine.org/2044/export-problem-custom-godot-build

Basically I think you have to use this command:
scons platform=<your platform> tools=no target=release (platform is x11 for linux and windows for windows, I don’t know for others)
And then copy the resulting binary at the same location as where your export templates are (.godot/templates (on Linux) or /AppDataRoaming/Godot/Templates on windows, maybe).

Thanks! It’s works!

Kovalski | 2017-02-09 15:06