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"

Syntax Error: identifier 'FHttpRequestPtr'

I cannot test http in ue4. I have read some tutorial but I cannot reimplement them.

HttpTestGameMode.h:

 UCLASS()
 class PROGRAMMINGTUTORIAL_API AHttpTestGameMode : public AGameMode
 {
     GENERATED_BODY()
 
 public:
 
     virtual void BeginPlay() override;
 
     void OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccessful);
 
 private:
     class FHttpModule* Http;
 
     void SetHttpModule();
     
 };



HttpTestGameMode.cpp:

 #include "Http.h"
 #include "HttpModule.h"
 #include "IHttpRequest.h"
 #include "IHttpBase.h"
 #include "IHttpResponse.h"

 ...
 Request->OnProcessRequestComplete().BindUObject(this, &AHttpTestGameMode::OnResponseReceived);
 ...

 void AHttpTestGameMode::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccessful)
 {
 //TODO IMPLEMENT LATER
 }



Error Message:

 HttpTestGameMode.h(20): error C2061: syntax error: identifier 'FHttpRequestPtr'
 HttpTestGameMode.h(20): error C2061: syntax error: identifier 'FHttpRequestPtr'
 HttpTestGameMode.cpp(20): error C2664: 'void TBaseDelegate<TTypeWrapper<void>,FHttpRequestPtr,FHttpResponsePtr,bool>::BindUObject<AHttpTestGameMode,>(UserClass *,void (__cdecl AHttpTestGameMode::* )(FHttpRequestPtr,FHttpResponsePtr,bool) const)': cannot convert argument 2 from 'void (__cdecl AHttpTestGameMode::* )(void)' to 'void (__cdecl AHttpTestGameMode::* )(FHttpRequestPtr,FHttpResponsePtr,bool)'


Build.cs:

 PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HTTP" });
Product Version: UE 4.10
Tags:
more ▼

asked Jan 04 '16 at 12:52 PM in C++ Programming

avatar image

ErayT
250 36 37 169

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

1 answer: sort voted first

Try adding #include "Http.h" in your header file. FHttpRequestPtr and FHttpResponsePtr are type defs which are defined in IHttpRequest.h which is included in Http.h.

more ▼

answered Jan 06 '16 at 06:51 AM

avatar image

Solid Snake
41 1 2 2

avatar image ErayT Jan 06 '16 at 10:26 AM

It might cause a problem if I include it in my header file? I was doing such trick for other classes by putting the keyword 'class' for classes not to include them in header but cpp file. However, because they are typedefs, I do not know what to do.

avatar image Solid Snake Jan 06 '16 at 11:13 PM

It shouldn't cause any problems.

Adding class in front of class definitions in header files isn't a "trick", it is called a forward declaration. A forward declaration is simply identifying something without giving it a complete definition. If your header needed to know more details about the class, then doing a forward declaration wouldn't work.

Typedefs are more or less a mapped identifier. That is to say, you're saying X is Y. It is an ease of use keyword, for example instead of typing TArray all the time you can typedef it to just be MyClassPointerContainer and use that. That is what FHttpRequestPtr and FHttpResponsePtr are.

avatar image ErayT Jan 07 '16 at 09:35 AM

Thank you for that detailed answer :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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