Search code examples
desktop-bridgec++-winrt

UWP c++ winrt app shows SHGDNF is unidentified in ShObjldl_core.h


I'm moving a c# .netcore application to UWP desktop bridge. I'm able to deploy and build the app, but when adding the c++ winrt component I get an error indicating SHGDNF is unidentified in ShObjldl_core.h below is pch.cpp

`#pragma once
#include <stdio.h>

#include <tchar.h>

#include <Unknwn.h>

#include <winrt/base.h>

#include <shlwapi.h>
#include <pathcch.h>

#include <ShlGuid.h>

#include <ShObjIdl_core.h>

#include <ShlObj_core.h>

#include <cfapi.h>

#include <ntstatus.h>

#include <sddl.h>

#include <winrt\windows.storage.provider.h>

#include <winrt\Windows.Security.Cryptography.h>

#include <ppltasks.h>

#include <strsafe.h>`


Solution

  • You could press F12 over ShObjIdl_core.h to view the document, and you will see there is a #if statement #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) which says the header file is usable for Desktop Win32 apps(but not store apps). A C++/Winrt component project is not a Win32 app, therefore, ShObjIdl_core.h header could not be used in the project.