# Trying to get Quartz in a C++ class creating linker errors.

**URL:** <https://forums.unrealengine.com/t/trying-to-get-quartz-in-a-c-class-creating-linker-errors/821401>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [March 25, 2023, 2:25pm UTC](https://forums.unrealengine.com/t/trying-to-get-quartz-in-a-c-class-creating-linker-errors/821401 "2023-03-25T14:25:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![teawalsh1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@teawalsh1](https://forums.unrealengine.com/u/teawalsh1)\
**Post date:** [March 25, 2023, 2:25pm UTC](https://forums.unrealengine.com/t/trying-to-get-quartz-in-a-c-class-creating-linker-errors/821401/1 "2023-03-25T14:25:03Z")

</div>

Hi everyone,

I’m currently trying to create a new Actor derived class for my Unreal Project called MainClock.

The idea for this class is it will create a quartz clock and will dispatch events to other Actors with a certain interface.

Whenever I try to create a new or access the Quartz subsystem I get this error in Rider: linker command failed with exit code 1 (use -v to see invocation).

Any help or advice would be appreciated as I can’t seem to find much documentation or online discussion on how to interface with the Quartz subsystem.

My code is below:

header:

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Quartz/QuartzSubsystem.h"
#include "MainClock.generated.h"

UCLASS()
class PLAYGROUND_LITE_API AMainClock : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMainClock();

	UPROPERTY(EditAnywhere)
	class UQuartzSubsystem* Quartz;

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

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

};

```

cpp:

```auto
#include "MainClock.h"
#include "Quartz/QuartzSubsystem.h"

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

// Called when the game starts or when spawned
void AMainClock::BeginPlay()
{
	Super::BeginPlay();
	
	UWorld* World = GetWorld();
	Quartz = UQuartzSubsystem::Get(World);
	
}

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

}

```

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [March 25, 2023, 7:09pm UTC](https://forums.unrealengine.com/t/trying-to-get-quartz-in-a-c-class-creating-linker-errors/821401/2 "2023-03-25T19:09:40Z")

</div>

> [@teawalsh1](#):
>
> `Quartz`

Have you included the [AudioMixer](https://docs.unrealengine.com/5.1/en-US/API/Runtime/AudioMixer/) module in you build file?  
It’s the module required for quartz to work

> **[UQuartzSubsystem](https://docs.unrealengine.com/5.1/en-US/API/Runtime/AudioMixer/Quartz/UQuartzSubsystem/)**

```auto
PublicDependencyModuleNames.AddRange(new string[] { ... "AudioMixer" })

```

The staff also tackled a problem with quartz not long ago it might help

> [@Unable to Setup Quartz in C++?](https://forums.unrealengine.com/t/unable-to-setup-quartz-in-c/631787/2):
>
> What engine version are you on? There is a lot of work I’ve done coming out in 5.1 to make managing Quartz from C++ a bit easier. Can you tell where you are crashing with a debugger attached? Something inside of the UClockHandle::SetBeatsPerMinute() function is null. With a debugger attached, you could see what it invalid. Might be worth to mention that I’m still fairly new to C++. If you aren’t running with a debugger attached, this is the first thing I’d figure out. It will make life…

---

<div class="post-metadata">

**Author:** ![teawalsh1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@teawalsh1](https://forums.unrealengine.com/u/teawalsh1)\
**Post date:** [March 25, 2023, 9:20pm UTC](https://forums.unrealengine.com/t/trying-to-get-quartz-in-a-c-class-creating-linker-errors/821401/3 "2023-03-25T21:20:21Z")

</div>

Thanks for the tip! I wasn’t aware that individual modules needed adding to the build in that way but that’s useful to know and it solved my linker error! Many thanks 🙂
