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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

C++: Having trouble to build my project (HttpRequest)

Hello thanks for taking the time out of your day to read this!

First off I am fairly new to C++, but i have some experience in C and Java. I am trying to implement a HttpRequest for a database connection. However I can't even get the project to build. At first I tried to do it myself, but after it didn't work and I wasn't able to fix it on my own I tried following a tutorial from the wiki. However the results were the same.

HttpActor.h:

 #pragma once
 
 #include "GameFramework/Actor.h"
 #include "HttpActor.generated.h"
 #include "Runtime/Online/HTTP/Public/Http.h"
 
 UCLASS()
 class DBTST_API AHttpActor : public AActor
 {
     GENERATED_BODY()
     
 public:    
 
     FHttpModule *http;
 
     UFUNCTION()
         void MyHttpCall();
 
     void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
     
     AHttpActor(const class FObjectInizializer& ObjectInitializer);
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
 };

HttpActor.cpp:

 #include "DBtst.h"
 #include "HttpActor.h"
 
 
 // Sets default values
 AHttpActor::AHttpActor(const class FObjectInizializer& ObjectInizializer)
     : Super(ObjectInizializer)
 {
     Http = &FHttpModule::Get();
 }
 
 // Called when the game starts or when spawned
 void AHttpActor::BeginPlay()
 {
     MyHttpCall();
     Super::BeginPlay();
 }
 
 void AHttpActor::MyHttpCall()
 {
     TSharedRef<IHttpRequest> Request = Http->CreateRequest();
     Request->OnProcessRequestComplete().BindUObject(this, &AHttpActor::OnResponseReceived);
 
     Request->SetURL("192.168.1.15/MySQLDatabaseUtil/test.php");
     Request->SetVerb("GET");
     Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
     Request->SetHeader("Content-Type", TEXT("application/json"));
     Request->ProcessRequest();
 }
 
 void AHttpActor::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
 {
     TSharedPtr<FJsonObject> JsonObject;
     TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
 
     if (FJsonSerializer::Deserialize(Reader, JsonObject))
     {
         int32 receivedInt = JsonObject->GetIntegerField("customInt");
 
         GEngine->AddOnScreenDebugMessage(1, 2.0f, FColor::Green, FString::FromInt(receivedInt));
     }
 }
 

Build.cs:

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

Engine.ini in Saved\Config\Windows

These are all the errors I'm getting. I am pretty sure the MSB3075 error is the main problem, but I couldn't find anything on the internet. I would be extremely grateful if anyone on here could help me out.

Thanks in advance, Liqs!

Product Version: UE 4.12
Tags:
more ▼

asked Jan 05 '17 at 09:04 PM in C++ Programming

avatar image

Liqss
1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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