I’m getting the error and its frustrating me because I have no idea whats wrong, if anyone could help I would really appreciate it!
CompilerResultsLog:Error: Error Customblueprintfunctionlibrary.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl FHttpModule::Exec(class UWorld *,wchar_t const *,class FOutputDevice &)" (?Exec@FHttpModule@@UEAA_NPEAVUWorld@@PEB_WAEAVFOutputDevice@@@Z)
CompilerResultsLog:Error: Error Customblueprintfunctionlibrary.cpp.obj : error LNK2019: unresolved external symbol "public: virtual class TSharedRef<class IHttpRequest,0> __cdecl FHttpModule::CreateRequest(void)" (?CreateRequest@FHttpModule@@UEAA?AV?$TSharedRef@VIHttpRequest@@$0A@@@XZ) referenced in function "private: void __cdecl UCustomblueprintfunctionlib
rary::HttpRequest(void)" (?HttpRequest@UCustomblueprintfunctionlibrary@@AEAAXXZ)
CompilerResultsLog:Error: Error Customblueprintfunctionlibrary.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FHttpModule::StartupModule(void)" (?StartupModule@FHttpModule@@EEAAXXZ)
CompilerResultsLog:Error: Error Customblueprintfunctionlibrary.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FHttpModule::PostLoadCallback(void)" (?PostLoadCallback@FHttpModule@@EEAAXXZ)
CompilerResultsLog:Error: Error Customblueprintfunctionlibrary.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FHttpModule::PreUnloadCallback(void)" (?PreUnloadCallback@FHttpModule@@EEAAXXZ)
CompilerResultsLog:Error: Error Customblueprintfunctionlibrary.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FHttpModule::ShutdownModule(void)" (?ShutdownModule@FHttpModule@@EEAAXXZ)
CompilerResultsLog:Error: Error C:\Users\RG STUDIOS\Documents\Unreal Projects\MyProject2\Binaries\Win64\UE4Editor-MyProject2-8046.dll : fatal error LNK1120: 6 unresolved externals
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyProject2.h"
#include "Http.h"
#include "Json.h"
#include "Customblueprintfunctionlibrary.h"
bool UCustomblueprintfunctionlibrary::GetYoutubeUrls(FString Url, TArray<FString>& UrlArray)
{
return FFileHelper::LoadANSITextFileToStrings(*(FPaths::GameDir() + Url), NULL, UrlArray);
}
/**UCustomblueprintfunctionlibrary::constructt(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
//When the object is constructed, Get the HTTP module
Http = &FHttpModule::Get();
}**/
void UCustomblueprintfunctionlibrary::HttpRequest()
{
TSharedRef<IHttpRequest> Request = FHttpModule().Get().CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, &UCustomblueprintfunctionlibrary::OnResponseReceived);
//This is the url on which to process the request
Request->SetURL("http://localhost:8081/WebApi/getint.php");
Request->SetVerb("GET");
Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
Request->SetHeader("Content-Type", TEXT("application/json"));
Request->ProcessRequest();
FString complete = "swag";
}
void UCustomblueprintfunctionlibrary ::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
//Create a pointer to hold the json serialized data
TSharedPtr<FJsonObject> JsonObject;
//Create a reader pointer to read the json data
TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
//Deserialize the json data given Reader and the actual object to deserialize
if (FJsonSerializer::Deserialize(Reader, JsonObject))
{
//Get the value of the json object by field name
int32 recievedInt = JsonObject->GetIntegerField("customInt");
//Output it to the engine
FString File = FString::FromInt(recievedInt);
}
}
MY .H File
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Http.h"
#include "Json.h"
#include "Customblueprintfunctionlibrary.generated.h"
/**
*
*/
UCLASS()
class MYPROJECT2_API UCustomblueprintfunctionlibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
private:
UFUNCTION(BlueprintPure, Category = "GetUrls")
static bool GetYoutubeUrls(FString Url, TArray<FString>& UrlArray);
/* The actual HTTP call */
UFUNCTION()
void HttpRequest();
/*constructt(const class FObjectInitializer& ObjectInitializer);*/
/*Assign this function to call when the GET request processes sucessfully*/
void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
};