Adding components in C++ breaks project

I’m trying to get the hang of C++ in Unreal 4, I’m already familiar with regular C++ for the record.

I tried adding a UParticleSystemComponent to the header file of a test object that I made while following the quick start to programming in Unreal 4. But after compiling my project breaks completely, and crashes on start every time. I recompiled the code finally in VS and launching the project just brings back the project to the way it was back when I didn’t even have anything made.

This was all I added to the h file:
UParticleSystemComponent particleSystem;

Not even sure that is correct but it feels like it shouldn’t break the project that badly. Any help would be appreciated.

Hello, Torabi

Please note that in Unreal Engine 4 you should declare properties as pointers.
Thus, your code should look something like this:

UParticleSystemComponent* particleSystem;

Hope this helped!

Cheers!

Thank you!
I assume you just then you just create something for the pointer to point at like usual afterwards.