Download

[HELP]JUST beginner...

Hi :slight_smile: Let’s get to the point
This is an example

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

#pragma once

#include “CoreMinimal.h”
#include “GameFramework/Character.h”

/**
*
*/
class GOLDENEGG_API Myavatar
{
public:
Myavatar();
~Myavatar();

void TestFunc(TestST st);

};

struct TestST
{
int n;
};

This is my header file
and…

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

#include “Myavatar.h”

Myavatar::Myavatar()
{

}

Myavatar::~Myavatar()
{
}

void Myavatar::TestFunc(TestST st)
{

}

This is my cpp file
There’s still an error here “void Myavatar::TestFunc(TestST st)”
to be exact “TestFunc”…
It’s not compatible
Why isn’t it compatible…???

UE4 header parser expects you to use certain macros and naming conventions.

Taking what you’ve got there and quickly adding the missing macros and cleaning up other things:


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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"

USTRUCT()
struct FTestST
{
    GENERATED_BODY()

    int32 n;
};

UCLASS()
class GOLDENEGG_API AMyavatar : public ACharacter
{
    GENERATED_BODY()

public:
    AMyavatar(const FObjectInitializer& ObjectInitializer);

    void TestFunc(FTestST st);
};


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

#include "Myavatar.h"

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

void AMyavatar::TestFunc(FTestST st)
{
}

Would suggest checking out and following some of UE4 specific C++ tutorials.

Also, in future, remember you can wrap your C++ with the CODE tags (the # symbol) so it will show up nicer :slight_smile: