'MoveFileW': is not a member of 'IPlatformFile'

Hi, I’m trying to move a file (video recorded in background using OBS) to a usb drive, but I’m getting this error when building.

Here’s the relevant part of the code:

IPlatformFile& FileManager = FPlatformFileManager::Get().GetPlatformFile();
TArray<FString> Files = TArray<FString>();
FString Path = TEXT("C:\\Asuntoikkuna\\Videos");
FileManager.FindFiles(Files, *Path, TEXT("mp4"));
if (USBDriveLetter != TEXT("NO DRIVE"))
{
	FString To = USBDriveLetter.Append(TEXT(":\\"));
	for (FString File : Files)
	{
		FileManager.MoveFile(*To, *File);
	}
}

What am I doing wrong? I’m very new to C++, moved over from Unity with C# recently.

1 Like

This issue occurs when you include <windows.h> simultaneously. The MoveFile function is defined as a macro and gets replaced by MoverFileW, which does not actually exist.

so we need to replace #include <windows.h> by
#include “Windows/AllowWindowsPlatformTypes.h”
#include “windows.h”
#include “Windows/HideWindowsPlatformTypes.h”

here is the original website: 引用 windows 头文件的警告 / 错误 | 虚幻社区知识库