shaochun
(shaochun)
May 7, 2014, 10:13am
1
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.
shaochun
(shaochun)
May 7, 2014, 10:07pm
2
Or maybe someone could point out how to debug this issue?
Rama
(Rama)
May 8, 2014, 6:40am
3
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"
?
shaochun
(shaochun)
May 8, 2014, 7:05am
4
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);
};
shaochun
(shaochun)
May 8, 2014, 10:02am
5
FHttpRequestPtr is actually TSharedPtr< IHttpRequest > , where TSharedPtr isn’t supposed to be used in U* macro.
Source here .
Rama
(Rama)
December 11, 2014, 2:33pm
6
#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" //<~~~~~~~
});
VenomStyx
(VenomStyx)
October 28, 2022, 2:55am
7
For anyone else looking now, make sure you aren’t using UFUNCTION for the function. Apparently that causes issues. If anyone knows why i’d love to understand
2 Likes