0 votes

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.

in Engine by (85 points)

1 Answer

+1 vote
Best answer

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://godotengine.org/qa/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).

by (29,034 points)
selected by

Thanks! It's works!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.