Suddenly, adding any c++ files breaks something completely unrelated

Hello, really struggling with this one. I’m using c++ for most things, so i have a few c++ classes and everything was working fine until today, when I’ve added a new class that inherits from Actor, something like the bog standard one:

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

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

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

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

};

now this comes up whenever I try to compile:

G:\Unreal\UE_5.0\Engine\Source\Runtime\AudioMixer\Public\Quartz\AudioMixerQuantizedCommands.h(31): 
error C2838: 'PlaySoundW': illegal qualified name in member declaration
G:\Unreal\UE_5.0\Engine\Source\Runtime\AudioMixer\Public\Quartz\AudioMixerQuantizedCommands.h(31): 
error C2440: 'return': cannot convert from 'BOOL (__cdecl *)(LPCWSTR,HMODULE,DWORD)' to 'EQuartzCommandType'
G:\Unreal\UE_5.0\Engine\Source\Runtime\AudioMixer\Public\Quartz\AudioMixerQuantizedCommands.h(31): 
note: There is no context in which this conversion is possible

I am using UE5.

I have not touched the engine code at all, furthermore, if I remove any other of my c++ classes, the compile works. It’s almost as if there’s a limit to how many files I can have. But surely, this cannot be the case? and it’s not even that many files.

I have even tried adding a standard cpp class that doesn’t have anything to do with unreal, like so:

// CppTest.h
#pragma once

class CppTest
{
public:
     CppTest();

};

//CppTest.cpp
#include "CppTest.h"

CppTest::CppTest()
{
    
}

And it still fails with the exact same error.
Or even just adding an empty cpp file, also fails the build!

I am at my wits end here, I don’t even know where to start debugging this as this is so strange.
I’ve tried cleaning the solution, regenerating project files, removing intermediate, saved, binaries folders. It. Will. Not. Compile.
Any help at all would be greatly appreciated.

1 Like

Turns out, if was the unity build system, turning it off in the .Build.cs with bUseUnity = false; solved the issue. Apparently, this system is error prone and a as a result you get these weird errors.
Many thanks the the people from Unreal slackers who have helped.

4 Likes

Never use UnityBuild. #NotEvenOnce :woozy_face:

that is the default, though, and turning it off uses something like an extra 150gigs of drive space and takes more than 7 hours to complete, versus about 20gigs and 30 minutes to complete.

i’ve been using it for about 12 years now, and i only ever turn it off on build machines.

Not sure I’m seeing the same result, no noticeable increase in my compile times or how much space the project takes. Granted, it is not that big of a project.

I think @eblade is talking about engine from source right ?

Ah of course, that makes sense. Though, in my case, I do not build the engine from source and it is the project’s.build.cs that is modified.
Not much choice I’ve had, it just won’t build with unity, sadly :frowning:

I don’t use unity build as well, it has its pros and cons but for me I prefer it off, though with engine from source I’d probably have it on.

I remember reading this article when I decided to always have it off.

You’re probably just missing an include somewhere.

oh, yeah, i always build everything. i forget that it’s even possible to use the engine without source sometimes :smiley: sorry

unity is huge for build time improvements for the whole enchilada.

a couple of weeks ago, i wanted to try a non unity build on my dev machine, and it completely cracked out my installation after running out of disk space on the drive that it was building on, i had to redownload my entire project from version control to get it back working :expressionless:

IMO non-Unity build is superior, but if you ever have to build the whole thing, you’ll want it.

1 Like