Can't Compile

I’m using UE4 4.22.3

When I try to build it from the BullCowGame.uproject file it just says cannot be compiled. Try rebuilding from source manually.

This is what it says when I try to build using BullCowGame.uproject


Running D:/Epic Games/UE_4.22/Engine/Binaries/DotNET/UnrealBuildTool.exe  -projectfiles -project="D:/Unreal Projects/BullCowGame-starter-kit/BullCowGame.uproject" -game -rocket -progress -log="D:\Unreal Projects\BullCowGame-starter-kit/Saved/Logs/UnrealVersionSelector-2019.07.19-18.47.35.log"
Discovering modules, targets and source code for project...
While compiling D:\Unreal Projects\BullCowGame-starter-kit\Intermediate\Build\BuildRules\BullCowGameModuleRules.dll:
d:\Unreal Projects\BullCowGame-starter-kit\Source\BullCowGame.Target.cs(19,12) : error CS0246: The type or namespace name 'UEBuildBinaryConfiguration' could not be found (are you missing a using directive or an assembly reference?)
ERROR: Unable to compile source files.

When I try to build using Visual Studio 2019 I get this:

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB3075	The command ""D:\Epic Games\UE_4.22\Engine\Build\BatchFiles\Build.bat" BullCowGameEditor Win64 Development -Project="D:\Unreal Projects\MyProject\BullCowGame-starter-kit\BullCowGame.uproject" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command.	BullCowGame	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets	44

Build.cs


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

using UnrealBuildTool;

public class BullCowGame : ModuleRules
{
	public BullCowGame(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Slate" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

Target.cs

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

using UnrealBuildTool;
using System.Collections.Generic;

public class BullCowGameTarget : TargetRules
{
	public BullCowGameTarget(TargetInfo Target) : base (Target)
	{
		Type = TargetType.Game;
	}

	//
	// TargetRules interface.
	//

	public override void SetupBinaries(
		TargetInfo Target,
		ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
		ref List<string> OutExtraModuleNames
		)
	{
		OutExtraModuleNames.AddRange( new string[] { "BullCowGame" } );
	}
}

Editor.Target.cs

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

using UnrealBuildTool;
using System.Collections.Generic;

public class BullCowGameEditorTarget : TargetRules
{
	public BullCowGameEditorTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Editor;

        bUseUnityBuild = false;
        bUsePCHFiles = false;

        ExtraModuleNames.Add("BullCowGame");
    }
}

I solved it, IncrediBuild Coodinator wasn’t open.

Are you saying you installed a third party extension to solve it? Because you don’t need IncrediBuild to use the project.

It came with Visual Studio, I didn’t install anything besides the basics when I installed vs code, vs2019, vs2017

Incredibuild is an optional component. It’s not required to use Unreal or C++

I don’t remember clicking that but maybe I did. I think because I had that installed all my projects started using that to help compile and when it is closed I can’t compile or build.

Well you can open the Visual Studio Installer from your start menu and then click modify and then search for it in Indvidual Components and uncheck it if it is checked.

I see, thanks for the help.

I’m having the same issue, but I do not have the optional component installed, therefore I’m not quite sure how to fix it?

Could be a firewall issue

I had a similar issue, using MacOS Mojave 10.14

Apparently my xcode path was pointing to command line tools instead of the Xcode.app in /Applications.
(was also hinted by the Metal shader compilation warning about reverting to default shaders)

If anyone is getting the same issue, you can try checking your xcode path in Terminal:

xcode-select -p

This should say

/Applications/Xcode.app/Contents/Developer

If not, point this to the right directory by entering this:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

This switches the default path of xcode to the one in /Applications.

Hope this helps!

3 Likes

I had the same issue initially. It failed to compile when rebuilding the project for UE4 version 4.22.3 and gave the 'Cannot be compiled. Try rebuilding from source manually. ’ error message. I’d installed the project files into a new directory and not the one I normally use for Unreal projects.

Upon installing a fresh copy of the project from the zip file into my regular Unreal project directory it converted and compiled and loaded the project correctly. I assume that this caused some sort of path issue when attempting to compile the code.

It failed to compile when rebuilding the project for UE4 version 4.22.3 and gave the 'Cannot be compiled. Try rebuilding from source manually. ’ error message.

Having the same issue. I double click the project file I downloaded from the resources tab and it gives me the “BullCowGame could not be compiled. Try rebuilding from source manually.”

I do not have Incredibuild installed, and I’m currently using Unreal 4.23. I tried some of the solutions above and none of them worked. Any ideas? Do I need to somehow downgrade to 4.22 to make it work?

Hi dazrin, not sure if you have sorted this yet or not. If you have then ignore this but otherwise here are some instructions I made on setting up Visual Studio with Unreal Editor. Might be worth just checking this first to see if it resolves your issues. You should not need to downgrade your version of UE4 or need to install Incredibuild as it should work fine without doing either.

Once you have followed the instructions below close down Unreal Editor and Visual Studio and do a new clean copy of the zipped BullCowGame-starter-kit to a directory of your choice. Once copied double click on the BullCowGame.uproject file and choose yes when prompted with the following msg:

Rebuild%20message

hopefully after a short while the modules will be rebuilt correctly and the project will load in the Editor.

Linking to your desired C++ Code Editor

To select the C++ IDE to use with Unreal Engine select Edit – Editor Preferences from the menu and then Source Code from the General section on the right. Select your desired code editor from the drop down box. You will be prompted to restart the editor for the change to take place.

Installing the UnrealVS plugin

This tool enables Unreal games to be debugged using the tools available in Visual Studio.

Close VS.

Go to:

C:\Program Files\Epic Games\UE_4.22\Engine\Extras\UnrealVS\VS2019

and double click on the following file to install it:

UnrealVS.vsix

Then go to the Standard Toolbar Options icon on the toolbar and click on it and select Customise from the Add or Remove Buttons menu. Click on the Toolbar tab and select UnrealVS by ticking it’s check box.

This should add a Startup Project and Command line drop down boxes to the toolbar.

Set the Project Configuration setting to DebugGame Editor and you should be able to set breakpoints and debug the game from Visual Studio. It will launch the Unreal Editor and allow you to run the game in Viewport mode (not standalone).

Setup the Unreal debugging symbols

Go to:

C:\Program Files\Epic Games\UE_4.22\Engine\Extras\VisualStudioDebugging\

Copy the UE4.natvis file and place here:

My Documents\Visual Studio 2019\Visualizers

Create the Visualizers folder if it doesn’t already exist

Hey Ian!
I appreciate your response! However, after updating my visual studio, things have begun to work as intended!

Thank you for reaching out! The help is appreciated and I’m happy that I’m able to continue learning.

Cheers!

-Dazrin

You’re welcome, glad you got it sorted. Have fun!