C++ Build Fails on Default Template!

Hi, I am following a c++ tutorial. When I try and build the project in XCode, it fails. I have added a class to it, but the error doesn’t tract back to it. Can anyone see the problem from my console output:


Building MyProject6...
Performing full C++ include scan (building a new target)
Creating makefile for MyProject6 (no existing makefile)
Compiling with MacOSX SDK 10.11
Parsing headers for MyProject6
  Running UnrealHeaderTool "/Users/edwin/Documents/Unreal Projects/MyProject6/MyProject6.uproject" "/Users/edwin/Documents/Unreal Projects/MyProject6/Intermediate/Build/Mac/MyProject6/DebugGame/UnrealHeaderTool.manifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -rocket -installed
/Users/edwin/Documents/Unreal Projects/MyProject6/Source/MyProject6/PowerUp.h(17) : Found more than one edit/visibility specifier (VisibleDefaultsOnly), only one is allowed
Error: Failed to generate code for MyProject6 - error code: OtherCompilationError (5)
UnrealHeaderTool failed for target 'MyProject6' (platform: Mac, module info: /Users/edwin/Documents/Unreal Projects/MyProject6/Intermediate/Build/Mac/MyProject6/DebugGame/UnrealHeaderTool.manifest).
Command /Users/Shared/UnrealEngine/4.9/Engine/Build/BatchFiles/Mac/RocketBuild.sh failed with exit code 5

Thanks

Why can’t i build a default template??!!

I am using a default template to start my unreal project. I’ve added an empty class to it (with nothing but default constructors), and the build fails!
Here’s my console output, anyone see anything unusual? (Note i’m using XCode):


Check dependencies

Code Sign error: No provisioning profiles found: No non–expired provisioning profiles were found.

The problem is in Powerup.h line 17 - which must be a class that you’ve added. You have given a UProperty too many visibility specifiers. The first long-line in the above log.

Did you follow the iOS Quick Start guide? Especially Step 3: iOS Provisioning - Generate Signing Certificate

Why IOS? I’m a mac user, but i’ll have a look. Thanks.

I thought you were trying to build for iOS. That’s usually when you encounter a code signing issue like that. If you’re trying to build for OS X, you don’t need to follow the guide I linked of course. But make sure you didn’t select an iOS target in Xcode (next to the “Play” button in Xcode). “YourGameEditor - Mac” is probably the target you want.

Okay, makes sense. However, i thought you only target a platform when you export the final project. (i’ve used unity before and that was the case then). Is this true here aswell?

Also, where in XCode do I go to target a platform?

Okay. Maybe my tutorial is outdated. Is this likely? I’ll post my class anyway.
Here:


// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/Actor.h"
#include "PowerUp.generated.h"

UCLASS()
class MYPROJECT6_API APowerUp : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	APowerUp();
    
    UPROPERTY(EditDefaultsOnly, VisibleDefaultsOnly, Catagory = PowerUp);
    TSubobjectPtr<USphereComponent> TouchSphere;

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	
	
};

Any problems stand out?

That’s called Packaging in Unreal. But you still need to compile your C++ code if you want to try it. This is a bit different from a scripting language.

Upper left corner, the drop down box.

You’re using ‘EditDefaultsOnly’ and ‘VisibleDefaultsOnly’ - which conflict with each other, you can only use one or the other. Additionally, you’re using TSubObjectPtr which was removed back in 4.4 - you want to be using standard pointers now.

You’re also using a parameter-less constructor, which means you can’t use FObjectInitializer to actually create any sub-components, and therefore it won’t work. You need to use FObjectInitializer AND call super on the constructor.

EDIT: Merged these threads because they’re pretty much the same thing.

Okay, so how do i fix this? I’ve posted my code. Also, which box and which tab?

Here is the tutorial i am following, is it in date?