Good afternoon,
I got a problem trying to package a plugin with the header : “ShlObj_core.h” who let me read on AppData folder on Windows.
I got this problem first on a custom Blupint Plugin :
- UATHelper: Package Plugin Task (Windows): In file included from XXX\Test_Plugin\HostProject\Plugins\Test_Plugin\Intermediate\Build\HTML5\UE4\Development\Test_Plugin\Module.Test_Plugin.cpp:3:
- UATHelper: Package Plugin Task (Windows): XXX\Test_Plugin\HostProject\Plugins\Test_Plugin\Source\Test_Plugin\Private\Test_PluginBPLibrary.cpp(33,10): fatal error: ‘ShlObj_core.h’ file not found
- UATHelper: Package Plugin Task (Windows): #include “ShlObj_core.h”
- UATHelper: Package Plugin Task (Windows): ^~~~~~~~~~~~~~~
- UATHelper: Package Plugin Task (Windows): 1 error generated.
- UATHelper: Package Plugin Task (Windows): ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
- UATHelper: Package Plugin Task (Windows): Total build time: 16.19 seconds (Parallel executor: 3.77 seconds)
- UATHelper: Package Plugin Task (Windows): Took 16.4941091s to run UnrealBuildTool.exe, ExitCode=5
- UATHelper: Package Plugin Task (Windows): ERROR: UnrealBuildTool failed. See log for more details. (C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Game-HTML5-Development.txt)
- UATHelper: Package Plugin Task (Windows): (see C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\Log.txt for full exception trace)
- UATHelper: Package Plugin Task (Windows): AutomationTool exiting with ExitCode=5 (5)
- UATHelper: Package Plugin Task (Windows): BUILD FAILED
On my second try i try to create a plugin with just “ShlObj_core.h” with the import lib plugin, and i got this error:
- UATHelper: Package Plugin Task (Windows): Building 4 actions with 8 processes…
- UATHelper: Package Plugin Task (Windows): [1/4] PCLaunch.rc
- UATHelper: Package Plugin Task (Windows): [2/4] TestIncludeLib.cpp
- UATHelper: Package Plugin Task (Windows): C:\Program Files\Epic Games\UE_4.21\Engine\Source\Runtime\Core\Public\Core.h(6): warning: Monolithic headers should not be used by this module. Please change it to explicitly include the headers it needs.
- UATHelper: Package Plugin Task (Windows): C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winnt.h(603): warning C4005: ‘TEXT’: macro redefinition
- UATHelper: Package Plugin Task (Windows): C:\Program Files\Epic Games\UE_4.21\Engine\Source\Runtime\Core\Public\HAL/Platform.h(899): note: see previous definition of ‘TEXT’
- UATHelper: Package Plugin Task (Windows): C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winioctl.h(10229): error C4668: ‘_WIN32_WINNT_WIN10_TH2’ is not defined as a preprocessor macro, replacing with ‘0’ for ‘#if/#elif’
- UATHelper: Package Plugin Task (Windows): C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winioctl.h(10235): error C4668: ‘_WIN32_WINNT_WIN10_RS1’ is not defined as a preprocessor macro, replacing with ‘0’ for ‘#if/#elif’
- UATHelper: Package Plugin Task (Windows): C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winioctl.h(10240): error C4668: ‘_WIN32_WINNT_WIN10_TH2’ is not defined as a preprocessor macro, replacing with ‘0’ for ‘#if/#elif’
… - UATHelper: Package Plugin Task (Windows): C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winioctl.h(15657): error C4668: ‘_WIN32_WINNT_WIN10_RS1’ is not defined as a preprocessor macro, replacing with ‘0’ for ‘#if/#elif’
- UATHelper: Package Plugin Task (Windows): C:\XXX\Test_ImportLib\TestIncludeLib\TestIncludeLib\HostProject\Plugins\TestIncludeLib\Source\TestIncludeLib\Private\TestIncludeLib.cpp(29): warning C4005: ‘SSF_SHOWALLOBJECTS’: macro redefinition
- UATHelper: Package Plugin Task (Windows): C:/Program Files (x86)/Windows Kits/10/Include/10.0.18362.0/um/ShlObj_core.h(3356): note: see previous definition of ‘SSF_SHOWALLOBJECTS’
- UATHelper: Package Plugin Task (Windows): ERROR: UBT ERROR: Failed to produce item: C:\XXX\Test_ImportLib\TestIncludeLib\TestIncludeLib\HostProject\Plugins\TestIncludeLib\Binaries\Win64\UE4Editor-TestIncludeLib.pdb
- UATHelper: Package Plugin Task (Windows): (see C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt for full exception trace)
- UATHelper: Package Plugin Task (Windows): Total build time: 9.64 seconds (Parallel executor: 0.00 seconds)
- UATHelper: Package Plugin Task (Windows): Took 10.0802356s to run UnrealBuildTool.exe, ExitCode=5
- UATHelper: Package Plugin Task (Windows): ERROR: UnrealBuildTool failed. See log for more details. (C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt)
- UATHelper: Package Plugin Task (Windows): (see C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\Log.txt for full exception trace)
- UATHelper: Package Plugin Task (Windows): AutomationTool exiting with ExitCode=5 (5)
- UATHelper: Package Plugin Task (Windows): BUILD FAILED
Here my code :
#include “ShlObj_core.h”
#include
#include
//#include
//#include
//#include
//#include
//#include
#include
#include
using std::string;
#include
using std::cout;
using std::cerr;
using std::endl;
#include
#define SSF_SHOWALLOBJECTS
//Local method : Convert TCHAR to string
std::string TcharsToString(TCHAR const * scz)
{
#ifdef UNICODE
std::ostringstream ossA;
ossA << scz;
return ossA.str();
#else
return scz;
#endif
}
void FTestIncludeLibModule::StartupModule()
{
//Test lib
TCHAR szAppData[MAX_PATH];
HRESULT hr = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szAppData);
cout << "Get Application Data" << endl;
string path = "";
TCHAR szPath[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_APPDATA,
NULL,
0,
szPath)))
{
path = TcharsToString(szPath);
}
}