0

This question does not already have an answer
I know what an unresolved external symbol means - I'm asking specifically why when building as ARM the DirectX functions are missing for my project. When I build my DirectX project for Raspberry Pi I get the below link errors. Why is CoCreateInstFromApp missing only for the ARM build?

The Microsoft documentation on CoCreateInstanceFromApp implies it should simply be present in any Windows executable - this is in fact what I see when building x86 or x64 versions of the same project. It ought to be present, since DirectX does support ARM architecture - or have I missed something?

The project is including d3d11.lib & dxgi.lib, which I presumed it would pick up from the right directory - but get no specific errors about those libraries. The project is C++ in Visual Studio 2017 Pro v15.8.7.

Redacted link error:

DirectXTK_ARM.lib : error LNK2019: unresolved external symbol __imp_CoCreateInstanceFromApp referenced in function "long __cdecl CoCreateInstance ...

DirectXTK_ARM.lib : error LNK2019: unresolved external symbol __imp_PropVariantClear ....


More info, if required:

I have altered this Desktop Duplication sample from Microsoft to do a screen-shot instead of duplication, and thus removed the window code and used DirectXTK for saving the file. This works great on my desktop and on a Minnowboard (x64 Win10 IoT). But if I try and compile for Raspberry PI (ARM) it fails with the link error:

DirectXTK_ARM.lib(WICTextureLoader.obj) : error LNK2019: unresolved external symbol __imp_CoCreateInstanceFromApp referenced in function "long __cdecl CoCreateInstance(struct _GUID const &,struct IUnknown *,unsigned long,struct _GUID const &,void * *)" (?CoCreateInstance@@YAJABU_GUID@@PAUIUnknown@@K0PAPAX@Z)

DirectXTK_ARM.lib(WICTextureLoader.obj) : error LNK2019: unresolved external symbol __imp_PropVariantClear referenced in function "long __cdecl `anonymous namespace'::CreateTextureFromWIC(struct ID3D11Device *,struct ID3D11DeviceContext *,struct IWICBitmapFrameDecode *,unsigned int,enum D3D11_USAGE,unsigned int,unsigned int,unsigned int,unsigned int,struct ID3D11Resource * *,struct ID3D11ShaderResourceView * *)" (?CreateTextureFromWIC@?A0x2b71c33d@@YAJPAUID3D11Device@@PAUID3D11DeviceContext@@PAUIWICBitmapFrameDecode@@IW4D3D11_USAGE@@IIIIPAPAUID3D11Resource@@PAPAUID3D11ShaderResourceView@@@Z) 1

Community
  • 1
  • 1
noelicus
  • 14,468
  • 3
  • 92
  • 111
  • Generally ``CoCreateInstance`` and ``PropVariantClear`` are part of ``ole32.lib``. For UWP apps, they are also in the ``WindowsApp.lib`` which you should be used to link to every UWP app. – Chuck Walbourn Oct 18 '18 at 16:32
  • Thank you - looks promising. It's a console app that I want to run on win10 iot core, so it's not actually a uwp app. adding ole32.lib has made it link and build! Now I need to see if it'll run ... ! – noelicus Oct 22 '18 at 08:59
  • You can also try ``mincore.lib`` as your 'generic' lib. – Chuck Walbourn Oct 22 '18 at 16:15
  • ole32.lib did it! - if you stick those comments as an answer I shall accept it :) – noelicus Oct 23 '18 at 15:53

1 Answers1

1

CoCreateInstance and PropVariantClear are part of ole32.lib.

UWP apps should link with the umbrella WindowsApp.lib, but you can also link to umbrella mincore.lib for IoT apps.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81