I try to write a class which provides some calculation services. My class compiles correct, but when I try to include its .h file in the header file of an unreal enigne C++ wizard generated class. It doesn’t compile and output errors:
TYPE REDEFINITION.
It is really weird. What the correct syntax to use such class that has nothing to do with unreal engine’s classes. Or we should always derive our classes from some unreal engine class.
Unless I am mistaken, there is nothing that prevents you from this. The error looks more like you are redefining an existing class because you used the same name.
It really doesn’t like a redefinition of an existing class. I did a search in my project and didn’t find any other class with the same name. Also the project can compile correctly before I include its .h file in other’s header file. Thanks, at least I know it’s nothing to do with the syntax of unreal engine, I must made a mistake somehow
Out of curiosity, what is the name? It doesn’t have to be a class, it could conflict with any C++ type (struct, enum, typedef).
My Class name is Spring. I found out it’s because I missed “#pragma once” at the beginning of Spring.h and included it in a UE-generated header file. Finally UrealEngine makes both of them included in the other cpp file. It’s embarassing, I won’t miss it again. Thanks
can someone show code?