Error LNK2001: unresolved external symbol FHttpModule

after I migrated the old project to the new version of the tool I’m having this problem with the class Http.h

Error 12 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) C:\Users\Francisco\Documents\Unreal Projects\ShooterGame\Intermediate\ProjectFiles\Module.ShooterGame.cpp.obj ShooterGame

i using this module HTTP exactly i used in old version, someone know what can be?

grateful for the attention

How are you using it? Are you calling that function from anywhere else?

If you are using it directly in your game, make sure that you have

PrivateDependencyModuleName.AddRange(new string[] {"HTTP"});

in its .Build.cs file.

Also add HTTP_API to FHttpModule::Exec declaration if you’re calling that function from your game (which is not advised).

PrivateDependencyModuleName.AddRange(new string[] {“HTTP”}); that is ok

my request is:

FHttpModule *module = new FHttpModule();

Request = module->CreateRequest();

Request->SetVerb("GET");
Request->SetURL("url");
Request->OnProcessRequestComplete().BindUObject(this,&OnData);

as I said, the code was running on the old version, the only change was the construction of FHttpModule class, I used this syntax in old version:

FHttpModule *module = &FHttpModule::Get(); and now method Get dont exist, and module have a construct method
FHttpModule *module = new FHttpModule();

That suggests to me that the class was modified in some way

Get() should and does exist, and this is actually the only way you can use the HTTP module in your program. You cannot create a new instance of it that way.

Try opening /Engine/Source/Runtime/Online/HTTP/Public/HttpModule.h in text editor to double check that there are local changes that prevent you from seeing Get() method.

what this means and how HTTP_API add?

HTTP_API static FHttpModule & Get ();

Grateful for the attention

Use the Get(), you don’t have to change that header. HTTP_API is a macro which makes FHttpModule::Get() visible for external modules.

Just use this code for creating requests:

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

i got it, but look the print screen, i don´t know why,
but i don´t have access to method Get :~(

The hint may be inaccurate, especially if you are not using Visual Assist. Make sure you include Http.h and try compiling the code nevertheless.

thks man u right only my visual studio dont find the method.
but now code compile fine

Great, glad it’s resolved :slight_smile:

@RCL I have included Http.h file, using Xcode, but compiler complains that Http.h not found. Please help thanks.

The module where you are including that header should list HTTP module as one of its dependencies.

In a bit more human terms, take a look at *.Build.cs file for to the code where you are trying to use Http.h, and add “HTTP” to PrivateDependencyModuleNames array. Take a look how CrashReporterClient.Build.cs does that for a reference.

Hi RCL,

When you say “which is not advised” are you referring to calling “FHttpModule::Exec”, or are you recommending against using HTTP on the client side?

I’m assuming you mean the former, but I’m not quite sure.

No, using HTTP module is fine :slight_smile: