Error running exported project with Steamwork SDK: "The identifier "Steam" isn't declared in the current scope." (OSX)

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

I custom built Godot 3.2.1 with GodotSteam, and I am able to access the Steamworks SDK in the editor. However, when I export the project and run it, it closes almost immediately. If I execute it through the command line, I get the error:

“Parse Error: The identifier “Steam” isn’t declared in the current scope.”

So clearly the Steamworks library is being packaged with my executable. I tried looking up why this is happening, and as best as I can tell I need custom export templates for this. So I ran these commands:

scons platform=osx tools=no target=release_debug
scons platform=osx tools=no target=release

Which gave me two binary files, one for release and one for debug:

godot.osx.opt.64
godot.osx.opt.debug.64

But I can’t figure out how to use them. Or if I have successfully used them, it hasn’t solved my problem. I tried selecting them as Custom Templates for my Mac OS X Export preset, but that gives me the error:

“Could not find template app to export: /{absolutepathtosource}/bin/godot.osx.opt.debug.64”

(It shows the real path, I’m not posting the whole path here)

Which doesn’t make sense, because that IS the correct path. I even selected the file in the built in file explorer, so it’s definitely correct. I’ve tried putting them in different directories, including Application Support/Godot/templates/3.2.1.stable, and I even tried replacing the existing mac templates inside of the osx.zip in that folder. Every time, if I specify the custom template it gives that error. If I don’t specify the custom template, it exports but gives that runtime error.

How can I export the mac executable such that it can actually run with the Steamworks SDK?

:bust_in_silhouette: Reply From: Avantir

Found the fix. I replaced the binary templates inside of the Application Support/Godot/templates/3.2.1.stable/osx.zip file with the new ones for steam (renaming them to be the same as the old ones). That allowed the export to succeed, but running the application still gave an error, this time to do with being unable to find the libsteam_api.dylib file. So I copied that into the .app file, alongside binary executable, and then it worked.