How can I resolve the error "Unrecognized type 'FHttpRequestPtr'"?

I keep getting the error Unrecognized type ‘FHttpRequestPtr’ when compiling, however, both the followings have been added to the appropriate locations:

// LightSender.h
#include "Http.h" 
#include "LightSender.generated.h"

and

// LightSenderProject.Build.cs
PrivateDependencyModuleNames.AddRange(new string[] { "HTTP" }); 
PrivateIncludePathModuleNames.AddRange(new string[] { "HTTP" });

What else could I try?

Thanks.

Or maybe someone could point out how to debug this issue?

FHttpRequestPtr is defined in

IHttpRequest.h

which is included in

Http.h as

#pragma once

 // Module dependencies
#include "Interfaces/IHttpBase.h"
#include "Interfaces/IHttpRequest.h"
 #include "Interfaces/IHttpResponse.h"

Seems like what you have already would work

have you tried

#include "IHttpRequest.h"

?

Yes, but I am still getting the same error.
It seems that for some reason the .h file didn’t get parsed, even if I have cleaned the solution.

// LightSender.h
#pragma once

#include "GameFramework/Actor.h"
#include "Http.h"
#include "IHttpRequest.h"
#include "LightSender.generated.h"

/**
 * 
 */
UCLASS()
class ALightSender : public AActor
{
	GENERATED_UCLASS_BODY()

	/** point light component */
	UPROPERTY(VisibleAnywhere, Category = "Switch Components")
	TSubobjectPtr<UPointLightComponent> PointLight1;

	/** sphere component */
	UPROPERTY(VisibleAnywhere, Category = "Switch Components")
		TSubobjectPtr<USphereComponent> Sphere1;

	UFUNCTION()
		void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
	
};

FHttpRequestPtr is actually TSharedPtr< IHttpRequest > , where TSharedPtr isn’t supposed to be used in U* macro.

Source here.

#The Solution

If anyone else has this issue, the solution is that in addition to using

#include "Http.h"

you must also add this to your build.cs

PublicDependencyModuleNames.AddRange(new string[] { 
	"Core", "CoreUObject", "Engine", "InputCore",
           
        "HTTP"   //<~~~~~~~
});