[BUG?] Declaring an UObject/AActor crashes Unreal

Hello and good evening,

I am having some issues with unreal, i have added an AActor derived class through the editor, however, when I try to declare a variable using my new class in GameMode/HUD/Character classes unreal crashes while compiling, and then when I try to re-open the project it tries to compile the game again, however it always fail *even after the removal of the intermediate and binaries folder;

Here is how I am declaring the variable (maybe it’s not a bug and I am just doing things wrong, if so, please forgive me and teach me if possible how to do it right):

  1. Create the class through the editor (Add Code->AActor->RandomNamedClass)

  2. In visual studio, open the GameMode/HUD/Character class header file (.h)

  3. Add the “#include “RandomNamedClass.h”” line before the “.generated.h” include line

  4. In the public section of the class, adding “ARandomNameClass RandomNamedClass;”

  5. Save all and Compile

  6. Unreal then crashes while compiling, SOMETIMES the crash dialog shows up, shows the hardwareID and no mindump

Unreal Version: 4.7.6-2513093+++depot+UE4-Releases+4.7

OS: Windows 8.1 Pro build 9600

Visual Studio: Microsoft Visual Studio 2013 Ultimate with Update 4

Machine:

Processor: AMD FX-9590 @ 4.7Ghz

GPU: AMD/ATI Asus 290X 4GB

RAM: 32GB Corsair Dominator @2100Mhz

HDD: 3TB Generic HardDrive (with about 1.5TB free)

Thanks for the attention!

HERE IS THE CRASH REPORT (even though it doesnt help much…):

MachineId:2E3384B847BC13140697128FDF6CFC0D
EpicAccountId:004ca17c67454e0b8bd296ea723b0168

No minidump found for this crash.

Hello,

Please declare your field like this:

ARandomNameClass* RandomNamedClass;

Hope this helped!

Cheers!

Have you tried opening your solution in visual studio (without opening the Unreal Editor), compiling there (verify it actually compiles), and then restarting the Editor?

Hello, it did compile and the game does run now, but how do I set this pointer to a new object of my class? i have tried using “NewObject” and it crashes the editor just like if it wasn’t a pointer…

Thanks for the idea AdeptStrain, it does compile but unreal crashes now when launching (at 70% loading) and/or when playing the game TT-TT