4.23.1 Package Unable To Compile with Target.cs issue

Hello all,

Whenever I’ve attempted to cook content or package my project, I’ve gotten “ERROR: Unable to compile source files” with error codes CS1001, CS1513, CS1518, CS1022 (Picture below for reference). Same issue in this forum post: Can't package. Unable to compile source files - Platform & Builds - Unreal Engine Forums

My only plugins are Advanced Sessions and Steam Advanced Sessions.

I’ve tried: Verifying engine, disabling plugins, deleting Intermediate folder, deleting everything in the root folder besides Config folder, Content folder, SourceAssets folder, and .uproject file.

Opening the Target.cs file in question brings up this:

301824-2-edit.png

I’ve mostly worked with Blueprints for my projects, so I’m at a complete loss as to how to solve this.

Any help would be appreciated. Thank you.

In your forum post it looks like the game name is only made up of numbers. As far as I know this is not a valid name for classes in c# (and c++?). If you rename it to (for example) “N2222” it should work.

Edit: You could also add the ‘@’. This should prevent the error and still handle it as 2222 internally

Oh, sorry for the censors, but yes my project name does include numbers and alphabets. I think I may found part of the problem.

I packaged a blank project and compared the same file, and it seems like my project’s Source files are disassociated for some reason

So now I’m assuming I have to ‘re-link’ the Source files to my project, just not sure how

Oh, sorry for the censors, but yes my project name does include numbers and alphabets. I think I may found part of the problem.

I packaged a blank project and compared the same file, and it seems like my project’s Source files are disassociated for some reason

So now I’m assuming I have to ‘re-link’ the Source files to my project, just not sure how

I’ve managed to solve my issue with the help of a good friend. Relating to FreezerNick’s answer, turns out starting your project name with a number may not be advisable. Since my project didn’t have C++ files, I also had to create one (can be any class, just to generate the Source folder). These are the steps to what I did (sorry if it’s missing some things, I can’t remember every detail):

Make sure your UE4 is closed by checking the Task Manager, close UnrealCEFSubProcess if it’s there

  1. Add a C++ class to your project (File-> Create C++ Class, create anything). This should generate a Source folder in your root folder if you didn’t have one.
  2. Rename any non-.UASSET reference (mostly anything outside of your Content folder) of your project name to something else that starts with letters. (E.g “99RedBalloons” to “NinetyNineRedBalloons”)
  • Rename .uproject file

  • Right click .uproject file, edit with Notepad/Notepad++, rename

  • Go to Config folder, find references in DefaultGame.ini and DefaultEngine.ini, rename

  • Open the Source folder in your root folder and repeat. ANY reference of your old project name, whether it’s a folder, a .cs file, inside the .cs file, .cpp and header files, inside those files, anything.

  • Right click .uproject file and generate Visual Studio project files

  • Open the .sln file

  • Go to the Build tab at the top, Clean Solution, then Rebuild Solution. There might be some errors regarding plugins, delete the Binaries and Intermediate folders in your Plugins (e.g I have AdvancedSessions and SteamAdvancedSessions, so it would be Plugins->AdvancedSessions->AdvancedSessions->Delete Binaries and Intermediate.) Any error that shows MISSING UCLASS NAME is referring to your old project name, so double click it and rename.

  • Open the .uproject file. If it asks to rebuild, click Yes

  • Package

==========================================================================================
Again, this worked for me because my project name started with a number, so I would not advise using this approach if your predicament isn’t similar.

he tratado de compilar unreal engine en kali linux como root, pero el programa rehusa a correr con privilegios root, ya co cambie de directorio y cree otro usuario y no compila con ninguno de los dos ni en ningun directorio