[SOLVED] Cannot package Plugin due to AllowWindowsPlatformTypes.h not being found by the build tool

Hi there,

I have written a Plugin, basically a BP Function Library, which is Windows specific. Since it requires some Windows specific includes, I have used AllowWindowsPlatformTypes.h / HideWindowsPlatformTypes.h to include the proper header files.

The Plugin works perfectly in the editor and in a packaged game, but refuses to be Packaged using the Package function from the Plugin Windows. It fails with the following error:

fatal error C1083: Cannot open include file: ‘AllowWindowsPlatformTypes.h’: No such file or directory

Also compiling the Plugin in VS works without any issues. Any ideas about what I am missing here? I am on 4.20.3.

Thanks,
Marco.

UPDATE: I have tried also to WhiteList the Win64 platform inside the Build file but it doesn’t make any difference.
UPDATE2: I have tried multiple combinations of includes but eventually I always get an error that one include cannot be opened (like above)

SOLVED: see post #4 for the solution. Thanks to @kamrann for the tip that put me on the right track.

1 Like

Hi
Did you put these specific Windows headers inside a:


#if PLATFORM_WINDOWS
    ...
#endif 

I’m saying this because I believe my problem is similar to yours:
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1573026-privateincludepaths-adding-multiple-platforms-when-using-editor-s-launch

Codes for different platforms are being included together.

I’m going to try to create a project and see if I can reproduce the error again to send a bug submission about it.

I have tried that as well earlier on but did not make any difference. To be noted that my plugin works and can be included in a packaged project, but cannot be packaged standalone from the plugin window.

Ok, I was able to solve the issue. Here is the learning.

In order to package a standalone Plugin, the includes have to be more explicit than what is required by VS or to run/package the plugin as part of a project. I had to go through all the includes that were generating an error and add to their path. For example:


#include "AllowWindowsPlatformTypes.h"

becomes


#include "Windows/AllowWindowsPlatformTypes.h"

Or


#include "RunnableThread.h"

becomes


#include "HAL/RunnableThread.h"

4 Likes

I was having the same problem. Everything was fine on Visual Studio and Unreal Editor but when packaging the header files was missing.
I was able to solve adding more detail to my include paths as @vr_marco mentioned above. In my case , I changed this:


#include "sqlite3.h"

to this


#include "../SQLLite3/sqlite3.h"

then I started to get an error about the DLL missing that I solved here Packaging Plugin with third party Dll - C++ Gameplay Programming - Unreal Engine Forums

I believe I’ve found the *proper *way to solve this issue.



#include "Windows/PreWindowsApi.h"
#include "windows.h" // This works with other apis and should work when your includes include windows apis I think
#include "Windows/PostWindowsApi.h"


5 Likes

Works for me in 4.27 when including asio; thanks!