Download

FPlatformFileManager not working

Hi i am new to Unreal, Can someone tell me why Visual Studio underlines “FPlatformFileManager” red in the following script:

// Fill out your copyright notice in the Description page of Project Settings.

#include “Kinect.h”
#include <iostream>
#include <windows.h>
//#include <fstream>

// Sets default values for this component’s properties
UKinect::UKinect()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don’t need them.
//PrimaryComponentTick.bCanEverTick = true;

// ...

}

// Called when the game starts
void UKinect::BeginPlay()
{
Super::BeginPlay();

FPlatformProcess::CreateProc(TEXT("Count.exe"), nullptr, true, false, false, nullptr, 0, nullptr, nullptr);

    IPlatformFile &FilePlatform = FPlatformFileManager::Get().GetPlatformFile();

// ...

}

// Called every frame
void UKinect::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

// ...

}

So i think the issue is to include GenericPlatformFile.cpp. But i include GenericPlatformFile.h in my script, it doesn’t help. Can someone please get back to me on this?

  1. Only ever include the Header, not the cpp-files :wink:
    2)Does it just underline or does compilation fail?
    Sometimes VS is quite slow with parsing everything.

it underlines and fails to compile both. Also unreal fails to compile if i include the stdafx.h library. i tried both ways: #include “stdafx.h” and #include <stdafx.h>

I think it is not so safe to include “windows.h” directly, they may conflict with ue defines, you’d better try protect the include between
#include “AllowWindowsPlatformTypes.h”

#include “HideWindowsPlatformTypes.h”

And you may want to include “MinWindows.h” or the needed header if possible.

Old post, I know, but I had the same until I added the include #include “PlatformFilemanager.h”