x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Unresolved external in FHTTPModule

I just can't figure this one out. All the threads about HTTP seem to be quite old. I'm on 4.10.

2> [14/14] Link UE4Editor-FOTBS-Win64-DebugGame.dll 2> Creating library D:\UnrealEngine4\Projects\FOTBS\Intermediate/Build/Win64\UE4Editor\DebugGame\UE4Editor-FOTBS-Win64-DebugGame.lib and object D:\UnrealEngine4\Projects\FOTBS\Intermediate/Build/Win64\UE4Editor\DebugGame\UE4Editor-FOTBS-Win64-DebugGame.exp 2>FOTBSHTTP.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) 2>FOTBSHTTP.cpp.obj : error LNK2019: unresolved external symbol "public: virtual class TSharedRef __cdecl FHttpModule::CreateRequest(void)" (?CreateRequest@FHttpModule@@UEAA?AV?$TSharedRef@VIHttpRequest@@$0A@@@XZ) referenced in function "public: void __cdecl UFOTBSHTTP::MakeRequest(void)" (?MakeRequest@UFOTBSHTTP@@QEAAXXZ) 2>FOTBSHTTP.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FHttpModule::StartupModule(void)" (?StartupModule@FHttpModule@@EEAAXXZ) 2>FOTBSHTTP.cpp.obj : error LNK2001: unresolved external symbol "private: virtual void __cdecl FHttpModule::ShutdownModule(void)" (?ShutdownModule@FHttpModule@@EEAAXXZ) 2>D:\UnrealEngine4\Projects\FOTBS\Binaries\Win64\UE4Editor-FOTBS-Win64-DebugGame.dll : fatal error LNK1120: 4 unresolved externals

Product Version: UE 4.10
Tags:
more ▼

asked Feb 03 '16 at 07:49 PM in C++ Programming

avatar image

davek
150 13 8 10

avatar image DesertEagle_PWN Jun 29 '18 at 06:07 PM

Upvoted: I likewise encountered this issue working with HTTPModule in custom 4.20 engine build, still trying to rectify the problem.

avatar image illuMinatus87 Oct 08 '18 at 12:24 PM

Did you find an answer to this? I have the same problem in 4.20 (installed build). I did add "HTTP" to the Build.cs file. But it still fails.

edit: It must be a problem with my project (or the fact that I am trying to use the HttpModule in a plugin module). If I create a new project and add a C++ class with the HttpModule, it compiles fine.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Looks like you aren't including the http module into your project. I'm not sure what the exact dependency is, but check that you have this somewhere. In your MyGame.build.cs file.

     PublicDependencyModuleNames.AddRange(
         new string[] {
             ...
             "HTTP",
                         ...

You could touch one of the http cpp files (add a compiler error) and see if it catches it. I suspect it won't.

more ▼

answered Feb 04 '16 at 03:43 PM

avatar image

Crzyhomer STAFF
1.2k 34 26 103

avatar image davek Feb 05 '16 at 06:39 AM

Hi Josh, thanks for your reply. I included the dependency module and no change, still unresolved. And of course, adding compiler error into the HttpModule.cpp is not picked up by the compiler, even after dependency module inclusion. Basically - no change at all.

avatar image Crzyhomer STAFF Feb 06 '16 at 12:33 AM

If you are making a C++/Native application and not a fully blueprint game the fact that the forced compiler error isn't being picked up means something isn't right about the dependency checking or your build.cs file. Which certainly continue to cause link errors.

Can you look at your link.exe command line and see if the module is being referenced there? Or in any of the build command output?

I'd have to look into the UBT code to see where you could output some debugging to see what modules your project is attempting to bring in.

avatar image davek Feb 06 '16 at 07:08 AM

Thank you for the suggestion. I'm on VS2015 so I don't see the link.exe command line. Is there a way for me to see it ? I've included "HTTP" in both Build and Target.cs files

Build.cs

using UnrealBuildTool;

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

FOTBSHTTP.h

#pragma once

#include "FOTBS.h"

#include "Runtime/Online/HTTP/Public/Http.h"

#include "FOTBSHTTP.generated.h"

UCLASS() class UFOTBSHTTP : public UObject { GENERATED_BODY()

public: UFOTBSHTTP();

 void MakeRequest();

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

};

FOTBSHTTP.cpp

#include "FOTBS.h"

#include "FOTBSHTTP.h"

#include "Public/FOTBSHUD.h"

#include "Runtime/Online/HTTP/Public/HttpModule.h"

#include "Runtime/Online/HTTP/Public/Http.h"

UFOTBSHTTP::UFOTBSHTTP() {

}

void UFOTBSHTTP::MakeRequest() {

 FHttpModule httpmodule = FHttpModule::Get();
 TSharedRef<IHttpRequest> HttpRequest = httpmodule.CreateRequest();
 HttpRequest->SetVerb("GET");
 HttpRequest->SetURL(FString("http://myserver.com"));
 HttpRequest->OnProcessRequestComplete().BindUObject( this, &UFOTBSHTTP::OnResponseReceived );
 HttpRequest->ProcessRequest();

}

void UFOTBSHTTP::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful) {

 FString responseData = Response->GetContentAsString();

 if (!bWasSuccessful)
 {
     UE_LOG(LogTemp, Error, TEXT("Response was invalid! Please check the URL."));
     return;
 }


}

While I spent the last 25 years coding, the last time I was working with C++ was in DOS4GW times and the Windows syntax is certainly new to me so I keep spending time looking for answers. Would you by any chance be able to recommend good read about the logic behind modules and dependencies and maybe Visual Studio-specific considerations?

avatar image Crzyhomer STAFF Feb 09 '16 at 07:46 PM

Try upping the verbosity of logging under Tools:Options:ProjectsAndSolutions:BuildAndRun MSDN Link

I'm not familiar with your build flow. Internally we have Incredibuild and UnrealBuildTool (UBT) will generate a file that describes all the cl.exe and link.exe operations. Vanilla VS20xx will output a log as well.

I believe UBT ultimately uses MSBuild.exe to build things in your case, so there should be a log file somewhere with the output. I'm sorry I'm in "hand wavy" mode at the moment.

Add "-verbose" and/or "-xgeexport" to the compiler settings. They are under the NMake section of VS20xx. Right click on your project settings, Properties, Configuration Properties, NMake. You'll see the Build and Rebuild command lines.

As for "good reads", Unreal does a bunch of trickery with modules, but ultimately they are just DLLs. It's more a Windows consideration than a VS consideration. Unreal/UBT handles all the __declspec(dllexport) and __declspec(dllimport) magic via our MODULENAME_API define.
If you search for the variable ModuleApiDefine in our .cs files (UEBuildModule.cs), you'll see how that magic works. That converts to the right thing in WindowsPlatform.h (or any of the other platforms)

In this case I'm expecting the HTTP_API to be defined, which I believe it is, but then the .lib/.dll are not being included and thus the link error.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question