Errors when including winscard.h

Yeah, this is a necro - but recently had to do this for a project and this is one of the first things that pops up in search engines so wanted to post an answer.

In order to include winscard on Windows, you’ll need to add an additional library from the Windows SDK in your build.cs. Once you do that you can include winscard.h as a third party include and your all set.

In build.cs add:

PublicAdditionalLibraries.Add(Path.Combine(Target.WindowsPlatform.WindowsSdkDir,
                                        "Lib",
                                        Target.WindowsPlatform.WindowsSdkVersion,
					"um/x64", // Probably a way to get this dynamically, but I didn't bother since it's a short run one off.
					"winscard.lib"));

in your cpp add:

THIRD_PARTY_INCLUDES_START
#include <winscard.h>
THIRD_PARTY_INCLUDES_END

Once that’s in place the UnrealBuildTool will pull the library in, and you should be all set. I did this for blueprint library plugin recently and it worked well enough.

1 Like