The type or namespace name "UnrealBuildTool" could not be found

Does anyone know how to fix this?

I’ve never used c++ before but am trying my hand at it by making my first plugin (Unreal Engine Version 5.4), yet I cannot get this error resolved.

image

image



The first attempt at this was really cool, it worked and I have new blueprint nodes but then I adapted the code a little to add more features and now I’ve started getting this issue, which doesn’t seem like an issue with my code but moreso a dependency being correctly installed? But then again I’m brand new to all this so I don’t know.

So far I’ve verified the engine, cleaned and rebuilt the .sln, tried installing more components, I’ve installed the visual studio development plugin from the marketplace.

I looked back at my original code that worked and it didn’t have the “using UnrealBuildTool;” so maybe I’m not set up for that???

1 Like

@3dRaven Hope you don’t mind the direct @ but from experience I think you’d be the best person to ask what I’m doing wrong

1 Like

If you auto-generate a plugin it will automatically add unreal build tool. It’s probably needed in the packing phase of the project.

Have you tried cleaning out your project
Delete

  • Intermediate
  • DerivedDataCache
  • Binaries
  • Saved
  • .vs
    Right click your uproject file and “Generate Visual Studio project files”.
    Run and recompile. (Ok I see you followed those steps)

If you made an empty plugin and started adding code from a tutorial or based on another plugin the maybe the lack of generated files is throwing off the compiler in some way?

You could try installing a newer version of .Net (hard to say if that will influence the compile, I use it in other projects)

Are you building from the source version of the engine or are you using the binary version from the epic launcher?

  • Make sure your project is set to the default startup project. (it’s name should be in bold letters)

  • Is your configuration set to “Development Editor”

Do you have any custom settings for code cleanup in VS? Maybe it’s stripping out commands during compile too aggressively?

2 Likes

Tbh ive never tried this before so everything is default settings. Im justing the launchers 5.4 version, trying to do as little as possible in terms of customisation haha

I just create a new c++ project no starter content or anything, then add a new plugin, i choose the blank template, then i fill in the .h, .cpp and .cs files.

I Generate Visual Studio project files, clean and rebuild the .sln and have even tried the whole process from scratch several times

Admittedly my code is helped by chatgpt as ive only learned cpp basics so far and im trying to further my understamfing of the process to implement it in unreal (im worried about actually using cpp in a real project for this exact non compiling reason :joy: so i thought id make a plugin.

The plugin idea was to create a few blueprint nodes to generate and validate licence codes for an application, that worked and then i tried to make it better by adding a few more features anyway i can add the code below in case its a problem in it but im not sure that there is. Its set to development mode and ive got no custom settings. Im using vs 2022.

Maybe you could recommend a good way/resource to learn c++ for unreal engine or more specifically making blueprint nodes from c++ code :laughing:

1 Like

.build.cs file

using UnrealBuildTool;

public class LicenseManager : ModuleRules
{
public LicenseManager(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

    PublicIncludePaths.AddRange(
        new string[] {
            // ... add public include paths required here ...
        }
    );

    PrivateIncludePaths.AddRange(
        new string[] {
            // ... add other private include paths required here ...
        }
    );

    PublicDependencyModuleNames.AddRange(
        new string[]
        {
            "Core",
            "HTTP", // Ensure this is added for HTTP requests
            "Json", // JSON handling
            "JsonUtilities" // JSON utilities
        }
    );

    PrivateDependencyModuleNames.AddRange(
        new string[]
        {
            "CoreUObject",
            "Engine",
            "Slate",
            "SlateCore",
        }
    );
}

}

.h file

#pragma once

include “CoreMinimal.h”
include “Kismet/BlueprintFunctionLibrary.h”
include “LicenseManager.generated.h”

UCLASS()
class LICENSEMANAGER_API ULicenseManager : public UBlueprintFunctionLibrary
{
GENERATED_BODY()

public:
UFUNCTION(BlueprintCallable, Category = “License”)
static FString GenerateLicenseKey();

UFUNCTION(BlueprintCallable, Category = "License")
static bool ValidateLicenseKey(const FString& Key, bool bValidateOnline);

UFUNCTION(BlueprintCallable, Category = "License")
static bool ValidateKeyOffline(const FString& Key);

UFUNCTION(BlueprintCallable, Category = "License")
static bool ValidateKeyOnline(const FString& Key);

};

.cpp file

include “LicenseManager.h”
include “Misc/Guid.h”
include “Misc/SecureHash.h”
include “HttpModule.h”
include “Interfaces/IHttpRequest.h”
include “Interfaces/IHttpResponse.h”

FString ULicenseManager::GenerateLicenseKey()
{
FGuid NewGuid = FGuid::NewGuid();
return FString::Printf(TEXT(“PIXEL-%s”), *NewGuid.ToString(EGuidFormats::Digits));
}

bool ULicenseManager::ValidateLicenseKey(const FString& Key, bool bValidateOnline)
{
if (bValidateOnline)
{
return ValidateKeyOnline(Key);
}
else
{
return ValidateKeyOffline(Key);
}
}

bool ULicenseManager::ValidateKeyOffline(const FString& Key)
{
return Key.StartsWith(TEXT(“PIXEL-”));
}

bool ULicenseManager::ValidateKeyOnline(const FString& Key)
{
// Simplified online validation example
// Replace with your actual server-side validation logic
return false;
}

1 Like

Ok so I looked at your project.

It was lacking a few key elements.

The parts that rely on HTTP were pointing to the wrong header paths. (all I* files are in the folder interfaces)
The plugin structure also didn’t adhere to the normal module version of plugins with their startup and shut down phases (it isolates the plugin to it’s own module)

Here is a version that compiles fine, just add the json elements into the plugin build file (I just wanted to see if I can get it to compile and run)

LicenseManagerPlugin.zip (23.8 KB)

obraz

1 Like

You know what, I had just started over again and instead of choosing a blank plugin template I chose a blueprint function library template and it has the same structure you used, so for my own sanity ive gone over the plugin you got to work and my fresh one side by side until they are the same.

I’m going to save all, clean the solution and then build… :crossed_fingers:

Edit: Unsuccessful, that’s a pity. You’re experience really shows here that you got it to work :sweat_smile:

I’ll try opening yours and see if it compiles for me

Edit: So i generated the project files, cleaned and built and got these errors

I’m thinking this is a me problem at this stage in terms of how my visual studio is set up

Also, if it means anything useful, I can’t even open your project (clean download) (scratch that, for once clicking yes actually works and it rebuilds successfully)


In my project right click the uproject file and regeerate the vs project.
Once the sln file exists run it

it’s so weird, i generated the .sln for your project and ran it, said 0 errors.

I went to build>build solution - 0 errors

I went to build>clean solution, build>build solution - errors are back

It must be happening because I clean the solution (which is something i do just because ChatGPT kept saying to) maybe that’s a no no?

In any case, you’ve been really helpful/ I clearly need to enroll in a course to understand the process for working with c++ in Unreal, it’s a totally different ball game from blueprint only

Clean causes the intermediated files to be deleted.
You can either build or rebuild (clean + build)

1 Like

what do you know… rebuild = no errors! amazing. That’s crazy, i wonder if doing that fixes my own
5th attempt
Edit: no my own attempt doesn’t open any more and can’t be built.
Edit: I went through my project, replaced all my code with yours in each file. rebuilt and it works. It literally must have been something in the way it was written or spaced out maybe. I’m going to undo the fix and compare both sets of code to work out what it was.

Edit: This was the difference (.h file):
My code
image

Your code
image

Just adding in LICENSEMANAGER_API fixed it all

@3dRaven Your help was impeccable, now look at all the new blueprint nodes I’ve been able to create! I’m delighted :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.