Error LNK2001 Unresolved external symbol

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);

};

Hi Legacy379 ,

I believe you forgot to add the HTTP module to your dependencies in your build.cs file.

Hope that helps. Cheers,

Have you added HTTP to the PublicDependencyModuleNames in your x.build.cs file?

yeah I do have it added I have it setup like this:

using UnrealBuildTool;

public class MyProject2 : ModuleRules
{
	public MyProject2(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Http", "Json", "JsonUtilities" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

Hey,
I do have it added in my build.css file like this

using UnrealBuildTool;

public class MyProject2 : ModuleRules
{
	public MyProject2(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Http", "Json", "JsonUtilities" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

Hi, I can currently not verify it, but iI would try to UPERCASE the HTTP because the module is named uppercase.

Hey I already tried that, I changed it in the dependency, didnt work so uppercased the #include “HTTP.h” but that also didnt work, same problem

Could you try including HttpModule.h in your source as well?

Ok so I finally fixed it, the problem was with:

TSharedRef<IHttpRequest> Request = FHttpModule().Get().CreateRequest();

I replaced it with:

FHttpModule * http = &FHttpModule::Get();
TSharedRef<IHttpRequest> Request = http->CreateRequest();

thank you ( :