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"

Unrecognized type 'void' in FORCEINLINE fucntion

I have a function:

     UFUNCTION(BlueprintCallable, Category = "Resources", meta = (CompactNodeTitle = "SET"))
         static FORCEINLINE void Set(FResources r, EResource resource, float value)
         r.Set(resource, value);

The compiler refuses to compile this function for some reason stating: Unrecognized type 'void' - type must be a UCLASS, USTRUCT or UENUM

If I change void to something like int32 and add "return 0;" to the end of the function it works, but for some reason it won't compile as long as the return type is void. What the hell is going on?

EDIT: Forgot to mention that this error only occurs if the function is FORCEINLINE

Product Version: UE 4.12
more ▼

asked Aug 28 '16 at 03:41 PM in C++ Programming

avatar image

126 15 20 25

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

2 answers: sort voted first

// this compiles for me , Engine version 4.14 but only recently stepped version up so should no be an issue for 4.12 FORCEINLINE UFUNCTION(BlueprintCallable, Category = "Something|WasHere")
void Set_Root_Component(USceneComponent* newRoot) { ActorRootComponent = newRoot; }

more ▼

answered Jan 06 '17 at 05:38 AM

avatar image

26 2 1

avatar image DELTA_12 Jan 06 '17 at 11:43 AM

I've alreadly solved this a long time ago, but didn't updated the question, let me do that now

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


FORCEINLINE should be placed before UFUNCTION

more ▼

answered Apr 16 '18 at 03:36 PM

avatar image

925 20 44 64

avatar image MichaelWion Mar 06 '19 at 09:27 AM

Wow, that actually compiles... seemingly even for non-void return types. This makes me wonder why the starter template code, as well as several C++ examples from Epic Games doesn't do this.

avatar image MichaelWion Mar 08 '19 at 05:08 AM

It appears that there are some side-effects to placing FORCEINLINE before UFUNCTION for non-void return types. While it works fine in C++, it might not show up in Blueprints anymore. So I guess you should only do it for non-void return types, or not at all if you want the function to be used within blueprints.

avatar image Arty-McLabin Mar 09 '19 at 09:57 AM

void c++ functions are translated to BP as events. i am not sure how logical is for ue4 event to be inline. you can use int return type as a placeholder depending on your design. also try to access the event from event graph rather than overriding it in functions tab is thats what you do

(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