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"

Error: C++ Default parameter not parsed: "nullptr"

I have a UFUNCTION that takes in a type of TScriptableInterface as one of its parameters. In the header, I have default values set for everything so when called in blueprint the function node has the defaults auto-filled. The compiler is throwing fits about object types not having a default value when the primitives do, so I want to set it to nullptr just to make it happy. This works for class types AActor actor = nullptr, but not for TScriptableInterface for some reason. Is there another null type I can set it to?

 UFUNCTION(BlueprintCallable, Category="BuffComponent")
  virtual void Initialize(
     float _timeCreated = 0.0, 
     float _lifeSpan = 6.0, 
     float _tickRate = 1.0, 
     bool _bIsExpirable = true, 
     TScriptInterface<class IBuffableInterface> _owner = nullptr
  );



 Error: C++ Default parameter not parsed: _owner "nullptr"
Product Version: UE 4.14
Tags:
more ▼

asked Feb 18 '17 at 08:19 AM in C++ Programming

avatar image

GhostRavenstorm
106 33 37 41

avatar image GhostRavenstorm Feb 18 '17 at 08:38 AM

What hasn't worked so far.

Error: C++ Default parameter not parsed: _owner "UObjectPtr"

Error: C++ Default parameter not parsed: _owner "this'

Error: C++ Default parameter not parsed: _owner "TScriptInterface>class IBuffableInterface>()"

Error: C++ Default parameter not parsed: _owner "(IBuffableInterface*)nullptr"

:/

avatar image GhostRavenstorm Feb 20 '17 at 09:45 AM

I guess this is just a case of UHT being weird. Can anyone confirm this?

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

1 answer: sort voted first

TScriptInterface is not a pointer type.

Can you use TScriptInterface* _owner = nullptr instead?

more ▼

answered Feb 18 '17 at 11:06 AM

avatar image

Wurmloch83
586 14 12 37

avatar image GhostRavenstorm Feb 18 '17 at 07:28 PM

( ..., TScriptInterface *_owner = nullptr );

Error: Missing '<' in TScriptInterface

I read somewhere that TScriptInterface is a smart pointer. I'm not entirely sure what the key differences are.

avatar image Wurmloch83 Feb 18 '17 at 07:42 PM

The LT and GT signs are somehow eaten up by this website, I originally wrote TScriptInterface&LT;class IBuffableInterface&GT; (hopefully shown now)

But if it is a smart pointer, forget about passing it as pointer as I suggested... It may be impossible to give it default value when used as UFUNCTION parameter. The UHT is not perfect yet. May someone correct me if I am wrong.

You can at least move the problematic paramter to the first position, so you can keep the default values for the other parameters. Sorry that I can not help you further.

avatar image GhostRavenstorm Feb 19 '17 at 06:18 PM

I tried TScriptInterface>class IBuffableInterface> *_owner. Compiler says inappropriate use of *, cannot have an exposed pointer to this type. And having a parameter with no default value as the first doesn't work. Either everything has a default value or it doesn't.

(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