Skip to main content
deleted 46 characters in body; edited title
Source Link
user1430
user1430

Error Why do I get this C2010 | (Variable) Unexpectederror while trying to use multicast delegates in a marco formalUnreal?

Don't hate on me I'm new to unreal engine :(

Other errors I got when compiling:

Not instance of ADD_INTERNAL_DYNAMIC matches the argument list

DECLARE_DYNAMIC_MULTICAST_DELEGATE_Threeparams marco redefinition

Note: See previous definition of DECLARE_DYNAMIC_MULTICAST_DELEGATE_Three params

  • No instance of ADD_INTERNAL_DYNAMIC matches the argument list

  • DECLARE_DYNAMIC_MULTICAST_DELEGATE_Threeparams Marco redefinition Note: See previous definition of DECLARE_DYNAMIC_MULTICAST_DELEGATE_Three params

XD.cpp:

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

#include "Test2.h"
#include "XD.h"

// Sets default values
AXD::AXD()
{
  // 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;

 newMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Static Mesh"));
 newBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Collision Box"));
 newBox->OnComponentBeginOverlap.AddDynamic(this, onCollide);
}

// Called when the game starts or when spawned
void AXD::BeginPlay()
{
    Super::BeginPlay();
 
}

// Called every frame
void AXD::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

}

XD.h

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

#pragma once

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

#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(UPrimitiveUPrimitiveComponent* a, AActor* b, UPrimitiveComponent c);

UCLASS()
class TEST2_API AXD : public AActor
{
    GENERATED_BODY()

public: 
    // Sets default values for this actor's properties
    AXD();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;
    UPROPERTY(EditAnywhere)
    UStaticMeshComponent* newMesh;

    UPROPERTY(EditAnywhere)
    UBoxComponent* newBox;

    UFUNCTION()
    void onCollide(class UPrimitiveComponent* a, class AActor* b, class UPrimitiveComponent* c)
    {
        Destroy();
    }

};

Error C2010 | (Variable) Unexpected in a marco formal

Don't hate on me I'm new to unreal engine :(

Other errors I got when compiling:

Not instance of ADD_INTERNAL_DYNAMIC matches the argument list

DECLARE_DYNAMIC_MULTICAST_DELEGATE_Threeparams marco redefinition

Note: See previous definition of DECLARE_DYNAMIC_MULTICAST_DELEGATE_Three params

XD.cpp:

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

#include "Test2.h"
#include "XD.h"

// Sets default values
AXD::AXD()
{
  // 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;

 newMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Static Mesh"));
 newBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Collision Box"));
 newBox->OnComponentBeginOverlap.AddDynamic(this, onCollide);
}

// Called when the game starts or when spawned
void AXD::BeginPlay()
{
    Super::BeginPlay();
 
}

// Called every frame
void AXD::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

}

XD.h

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

#pragma once

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

#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(UPrimitiveUPrimitiveComponent* a, AActor* b, UPrimitiveComponent c);

UCLASS()
class TEST2_API AXD : public AActor
{
    GENERATED_BODY()

public: 
    // Sets default values for this actor's properties
    AXD();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;
    UPROPERTY(EditAnywhere)
    UStaticMeshComponent* newMesh;

    UPROPERTY(EditAnywhere)
    UBoxComponent* newBox;

    UFUNCTION()
    void onCollide(class UPrimitiveComponent* a, class AActor* b, class UPrimitiveComponent* c)
    {
        Destroy();
    }

};

Why do I get this C2010 error while trying to use multicast delegates in Unreal?

Other errors I got when compiling:

  • No instance of ADD_INTERNAL_DYNAMIC matches the argument list

  • DECLARE_DYNAMIC_MULTICAST_DELEGATE_Threeparams Marco redefinition Note: See previous definition of DECLARE_DYNAMIC_MULTICAST_DELEGATE_Three params

XD.cpp:

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

#include "Test2.h"
#include "XD.h"

// Sets default values
AXD::AXD()
{
  // 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;

 newMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Static Mesh"));
 newBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Collision Box"));
 newBox->OnComponentBeginOverlap.AddDynamic(this, onCollide);
}

// Called when the game starts or when spawned
void AXD::BeginPlay()
{
    Super::BeginPlay();
 
}

// Called every frame
void AXD::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

}

XD.h

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

#pragma once

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

#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(UPrimitiveUPrimitiveComponent* a, AActor* b, UPrimitiveComponent c);

UCLASS()
class TEST2_API AXD : public AActor
{
    GENERATED_BODY()

public: 
    // Sets default values for this actor's properties
    AXD();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;
    UPROPERTY(EditAnywhere)
    UStaticMeshComponent* newMesh;

    UPROPERTY(EditAnywhere)
    UBoxComponent* newBox;

    UFUNCTION()
    void onCollide(class UPrimitiveComponent* a, class AActor* b, class UPrimitiveComponent* c)
    {
        Destroy();
    }

};
Source Link
Aaron
  • 27
  • 3
  • 5

Error C2010 | (Variable) Unexpected in a marco formal

Don't hate on me I'm new to unreal engine :(

Other errors I got when compiling:

Not instance of ADD_INTERNAL_DYNAMIC matches the argument list

DECLARE_DYNAMIC_MULTICAST_DELEGATE_Threeparams marco redefinition

Note: See previous definition of DECLARE_DYNAMIC_MULTICAST_DELEGATE_Three params

XD.cpp:

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

#include "Test2.h"
#include "XD.h"

// Sets default values
AXD::AXD()
{
  // 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;

 newMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Static Mesh"));
 newBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Collision Box"));
 newBox->OnComponentBeginOverlap.AddDynamic(this, onCollide);
}

// Called when the game starts or when spawned
void AXD::BeginPlay()
{
    Super::BeginPlay();
 
}

// Called every frame
void AXD::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

}

XD.h

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

#pragma once

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

#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(UPrimitiveUPrimitiveComponent* a, AActor* b, UPrimitiveComponent c);

UCLASS()
class TEST2_API AXD : public AActor
{
    GENERATED_BODY()

public: 
    // Sets default values for this actor's properties
    AXD();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;
    UPROPERTY(EditAnywhere)
    UStaticMeshComponent* newMesh;

    UPROPERTY(EditAnywhere)
    UBoxComponent* newBox;

    UFUNCTION()
    void onCollide(class UPrimitiveComponent* a, class AActor* b, class UPrimitiveComponent* c)
    {
        Destroy();
    }

};