C++ cannot create constructor AActor

I am reading this tutorial https://docs.unrealengine.com/latest/INT/Programming/QuickStart/4/index.html

and I want to create consturctor in my own class which I created via Editor. But what happens it says “Constructor cannot be redeclared”. I am using latest UE4 (4.6)

I also found this: Actor code incorrectly generated in version 4.6.0 - Programming & Scripting - Unreal Engine Forums

but it doesn’t resolve the problem.

In your .cpp file did u have this

AAmmoPickupActor::AAmmoPickupActor(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{}

And if you don’t need to use that initialize u can just remove it, if still have the problem i recommend u to try GENERATED_UCLASS_BODY() instead for now

You need to use GENERATED_UCLASS_BODY() and the declaration for the constructor is created automatically. At which point, you only need to add this to your cpp file.

AAmmoPickupActor::AAmmoPickupActor(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
{

}

Keep in mind that the editor uses this constructor to create a default object.

Wasn’t that the way to declare the constructor prior to 4.6 ?

I’ve followed the same tutorial yesterday and had no issue. If you hit the build button, does it compile ? From my exprience, Visual Studio can display false positive information, I have noticed this behavior even on the official video tutorials,

Yes. My bad. Second part still applies. Instead of the postconstructinitializeproperties, you FObjectInitializer I believe. Writing this from memory.

Got stumped by this as well, seems to like this is just xcode complaining unnecessarily… it built fine for me when I tried to recompile from the editor and then the error went away in xcode as well.