Plugin : How to properly include a struct
in my Plugin I've got a Object which inherits from UObject. It's name is Watcher. Inside Watcher.h I declared a USTRUCT FMyStruct. The struct consists of some FVectors. Then I've got another Object inherited from UObject called Tracer. Watcher has a member of type Tracer. I want Tracer to do LineTraces , so i declared a method with Parameter MyStruct. Inside Watcher.h I included Tracer.h . Inside Tracer.h I included Watcher.h . Compiler can't resolve type of parameter FMyStruct in void Trace(..) . I've tried different includes. None worked for me. How do I include properly?
asked Nov 15 '17 at 10:02 PM in C++ Programming
You can use forward type declarations here. For example in your header you can write
without including files with UFish declarations. This method have limitations - you can declare only pointers or references of unknown classes and can't use any methods of this class in the file before including a header related to the class. When creating a .cpp file you still have to include all required headers to use your classes.
If it's not applicable you can move your UStruct declaration to a separate file and include it both from watcher and tracer files.
Follow this question
Once you sign in you will be able to subscribe for any updates here