Errors during build

I don’t understand how the path or file name can be too long when the path is “C:/UE/” and the file name is just “R”?

I have tried moving the path and changing the file name but with no results.

I can’t add C++ code to an existing project nor create a brand new empty C++ project.

:

Running C:/Program Files/Epic Games/UE_4.19/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project=“C:/UE/R/R.uproject” -game -rocket -progress

ERROR: UnrealBuildTool Exception: System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Howdy @P.A.S.C. You are correct in stating those file paths aren’t too long in themselves, however it is possible the build process is creating something us a much-longer file path.
If you are building from visual studio, when the Errors window pops up, there should be a “output” tab, with a “build output” option in a drop down box.
If possible post the contents of that window, it may provide some insight!

Thank you for the reply.

So, the thing is that I haven’t actually created any C++ code at all as I am in the process of learning how to and also that I can’t add any sort of C++ file/project to anything in UE4.

The error occurs when I either do : Add New → Add New C++ Class when in a blueprint project or loading a simple plain C++ new project.

When opening Visual Studio and building a default project on the other hand and then building it gives me :

1>------ Build started: Project: WindowsProject1, Configuration: Debug Win32 ------
1>stdafx.cpp
1>WindowsProject1.cpp
1>WindowsProject1.vcxproj -> C:\Users\Default\source\repos\WindowsProject1\Debug\WindowsProject1.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Update : So visual studio needed an update and right after, my Epic Games Launcher became corrupted and couldn’t be launched. I am currently re-installing

Update 2 : Re-installed, still the same error. System.IO.PathTooLongException

if you right click on your Uproject file (in folder-explorer), you should be able to “generate visual studio project”.
That will create a VS .sln file for your project (that you can open in visual studio!) doing so should allow you to get the compiler-log for your project.

Upon doing so, it seems to work at first with the logs runnings.

Running C:/Program Files/Epic Games/UE_4.19/Engine/Binaries/DotNET/UnrealBuildTool.exe  -projectfiles -project="C:/Users/Default/Documents/Unreal Projects/J/J.uproject" -game -rocket -progress
Discovering modules, targets and source code for project...

After 2 seconds or so, the same error occurs.

Running C:/Program Files/Epic Games/UE_4.19/Engine/Binaries/DotNET/UnrealBuildTool.exe  -projectfiles -project="C:/Users/Default/Documents/Unreal Projects/J/J.uproject" -game -rocket -progress
Discovering modules, targets and source code for project...
ERROR: UnrealBuildTool Exception: System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
          at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
          at System.IO.Path.InternalGetDirectoryName(String path)
          at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
          at System.IO.Directory.EnumerateFiles(String path, String searchPattern)
          at UnrealBuildTool.VCProjectFile.WriteProjectFile(List`1 InPlatforms, List`1 InConfigurations)
          at UnrealBuildTool.ProjectFileGenerator.WriteProjectFiles()
          at UnrealBuildTool.VCProjectFileGenerator.WriteProjectFiles()
          at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(String[] Arguments)
          at UnrealBuildTool.UnrealBuildTool.GuardedMain(String[] Arguments)

I would try regenerating the visual studio files.

I would also try fixing up redirectors in your C++ folders and main content folders.

Can you try creating/moving your project to the root of your filesystem?
ie: rather than “C:/Users/Default/Documents/Unreal Projects/J/J.uproject”, move it to “C:/AFolderYouMake/J.uproject”

Also, are you using any additional assets / plugins that might be increasing the length of any files used in the project?

Hi there,

So by regenerating what exactly do you mean?
I’ve tried unstalling, reinstalling as well as fixing the version and modifying it.

Also for the redirectors, are you suggesting moving it to the root of the filesystem?

The only plugin i installed was the Steam/Steamworks plugin, and i did that one through the UE4 Project editor, and that worked fine and everything before I tried to start adding C++ code and it still works fine without issues.

Moved it to “C:/UE/J.uproject”, still get the same error

I do notice one new thing however that occured when moving the file closer to the root.

Before the relocation of the file, there wasn’t a “Compile” button in between the “Build” and “Launch” buttons, but now there is. Clicking on it just gives me the message :

“Warning: RebindPackages not possible (no packages specified)”

Right click on the .uproject file in windows explorer and select “generate visual studio project files”, this will refresh the VS .sln file.

Check inside your game-project as well to see if there are any extremely long folder/file combinations.
If neither of those actions solve your problem, I fear you are experiencing some kind of extreme bug/corruption of your UE4/VS/both

Does your steamworks plugin need anything from the steam folder? Is it possible something such as a steam library/file or alike could exist at a location who’s file-path is longer than 256 characters?