header file:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "testing.generated.h"
UCLASS()
class TESTINGPROJECT_API Atesting : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
Atesting();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
c++ file:
// Fill out your copyright notice in the Description page of Project Settings.
#include "testing.h"
// Sets default values
Atesting::Atesting()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
SphereComponent->InitSphereRadius(40.0f);
}
// Called when the game starts or when spawned
void Atesting::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void Atesting::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
log file in after compilation:
Running Mono...
Setting up Mono
/Users/Shared/Epic Games/UE_4.18/Engine /Users/Shared/Epic Games/UE_4.18/Engine/Binaries/Mac
Compiling game modules for hot reload
Parsing headers for TestingProjectEditor
Running UnrealHeaderTool "/Users/user/Documents/Unreal Projects/TestingProject/TestingProject.uproject" "/Users/user/Documents/Unreal Projects/TestingProject/Intermediate/Build/Mac/TestingProjectEditor/Development/TestingProjectEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for TestingProjectEditor in 23,7330906 seconds
Performing 2 actions (4 in parallel)
[1/2] Compile testing.cpp
/Users/user/Documents/Unreal Projects/TestingProject/Source/TestingProject/testing.cpp:11:5: error: use of undeclared identifier 'USphereComponent'; did you mean 'CaptureComponent'?
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
^~~~~~~~~~~~~~~~
CaptureComponent
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Components.h:1041:1: note: 'CaptureComponent' declared here
CaptureComponent(
^
/Users/user/Documents/Unreal Projects/TestingProject/Source/TestingProject/testing.cpp:11:5: warning: 'CaptureComponent' is deprecated: first deprecated in macOS 10.8 [-Wdeprecated-declarations]
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Components.h:1041:1: note: 'CaptureComponent' has been explicitly marked deprecated here
CaptureComponent(
^
/Users/user/Documents/Unreal Projects/TestingProject/Source/TestingProject/testing.cpp:11:64: error: use of undeclared identifier 'USphereComponent'
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
^
/Users/user/Documents/Unreal Projects/TestingProject/Source/TestingProject/testing.cpp:11:23: error: use of undeclared identifier 'SphereComponent'
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
^
/Users/user/Documents/Unreal Projects/TestingProject/Source/TestingProject/testing.cpp:12:21: error: use of undeclared identifier 'SphereComponent'
RootComponent = SphereComponent;
^
/Users/user/Documents/Unreal Projects/TestingProject/Source/TestingProject/testing.cpp:13:5: error: use of undeclared identifier 'SphereComponent'
SphereComponent->InitSphereRadius(40.0f);
^
1 warning and 5 errors generated.
ERROR: UBT ERROR: Failed to produce item: /Users/user/Documents/Unreal Projects/TestingProject/Binaries/Mac/UE4Editor-TestingProject-5390.dylib
Total build time: 96,76 seconds (Local executor: 0,00 seconds)
what I’m done wrong? is there any changes in spawning default components in 4.18?
os: Mac OS X 10.12.6
unreal engine: 4.18.0 with latest updates
x code: 8.2.1 (8C1002)