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"

C++ how to create a class with a function in it

Cant get simle C++ function to work in UE4 blueprint.

I am trying to make a C++ function that will sort an array inside blueprint. The problem is i can't get C++ and UE work together. I need a C++ class that is workable as an example. Can someone point me in the right direction or tell me what am i doing wrong?


 #pragma once
 #include "Object.h"
 #include "FromUobject.generated.h"
 class ANDROID_API UFromUobject : public UObject
 UFUNCTION(BlueprintCallable, Category = "Damage")
 void calcA();


  •    #include "Android.h"
            #include "FromUobject.h"
      void FromUobject::calcA{}

What am i missing here? how do i get it to work? Please HelP!

Product Version: UE 4.12
more ▼

asked Sep 10 '16 at 04:36 PM in C++ Programming

avatar image

71 9 10 18

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

1 answer: sort voted first

Your class name is actually UFromUobject, not FromUobject, and you need the arguments, even though it's empty. So the line

void FromUobject::calcA{}

should be

void UFromUobject::calcA(){}

more ▼

answered Sep 10 '16 at 04:40 PM

avatar image

629 26 28 55

avatar image Deemk0 Sep 10 '16 at 05:12 PM

anything else? should i include something else in the header?

avatar image Teiwaz Sep 10 '16 at 06:17 PM

Generally you'll want to include your project's header file. However, the boilerplate code the editor generates should take care of that for you. How are you creating these source files? If you create a new C++ class from the editor (file menu or the content browser) that sort of stuff will just be taken care of for you.

avatar image Deemk0 Sep 11 '16 at 02:03 PM

I am creating classes from UE editor, extending some of the basic C++ classes. The thing is that after creating some C++ classes, i lose ability to launch project on android device. Thanks you for your answer, it got me started. Going to dive further.

(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