Any C++ Breaks Any Project

A few weaks ago I tried starting a proiject as c++ but, whenever it would create the project, It would crash UE. So I instead started Blueprint and decided I’ll change to C++ later. I had a plugin that had to be rebuilt for UE5, it took several miserable hours just changing random things in my engine folders to get it to build properly. I was successful at the end but now I’m at a point where i need to convert my main project to C++. I made a backup, and proceeded to create new class and build project from VS 2022. The build would fail every time. Here is the error.

E:\Program Files (HDD)\Epic Games\UE_5.0\Engine\Build\BatchFiles\Build.bat" CS5Editor Win64 Development -Project="D:\Backup\Programming\Active Projects\CS5\CS5.uproject" -WaitMutex -FromMsBuild" exited with code 6

I had another error saying the plugin I rebuilt and worked completly fine said it was not compatible but still worked. But I don’t know if thats what’s causing that error. I tried using the backup on my laptop which had a fresh VS and UE5 install, but i got 300 errors and like 2000 warnings, just worsened things. Why is C++ so broken with UE5 and VS 2022? I’m stuck on my project now I can;t go on without being C++ really, other than working on maps on other Uprojects.

try using vs 2019

1 Like
exited with code 6

Is that annoying error which might mean anything, but usually means there is something wrong with your UPROPERTYs on a class, like an invalid or illegal property specifier.

Do you get any other build errors if you switch between the Error List tab and the Output tab in VS?

This is probably Intellisense screaming irrelevant things. You can disable intellisense output on your tabs and only show build errors.

1 Like

I tried VS 2019 and I got the same errors

Here are the errors:

And here is output:

The output only shows the exit code 6 error not the plugin error.

It’s funny that in the second screen shot, you cut off the part of the error message that actually would matter so we can’t read it :slight_smile:
Did you read it yourself? Does it say anything interesting?

In the first screen shot, it says the version number in some particular JSON file is not supported. This means that the file is too old, or perhaps too new, for the tool that’s trying to read it. This has to do with that file, and UnrealBuildTool, rather than Visual Studio. Then again, this probably means you’re trying to build the engine, rather than trying to just build a plugin.
In general, you shouldn’t have to build the engine. The engine can run pre-built just fine, and you only need to build/load your own C++ plugin.

Now, that’s opened from a folder called Backup which in turn contains a folder named Project Backups. That seems kind-of weird. If you have a backup, you really don’t want to be opening that up directly; rather, you’d want to copy/restore it into a better spot, and open from there. The reason I call this out, is that perhaps this project has been moved/copied in some way that doesn’t properly preserve paths, or that points paths across projects somehow?

For comparison, I have Visual Studio 2019 and Visual Studio 2022 installed, as well as standard downloaded Unreal Engine 5.0.2.
I started the UE5.0.2 engine from the Epic Launcher, and created a new Blueprint project based on the First Person Shooter starter, in a non-default location D:\UEProjects\TestFPS.
I can open and play this just fine.
I then choose Tools → New C++ Class → Blueprint Function Library and create a new class called TestBPLib, and choose to make it Public.
It then asks me to close the editor and build from the IDE. (I only need to do this once, when first adding C++ code.)
It opens VS2022, and ctrl-shift-B builds the code just fine (although first build takes a minute or two.)
MSBuild doesn’t like bAllowParallelExecutor or LocalExecutor in some config files, though, but that’s a warning, not an error.
I open the TestFPS project from Epic Launcher, and now my plugin is loaded and works. I can edit the code, add a static function that’s BlueprintCallable to my function library, and use “hot reload” in the lower-right corner menu of the Unreal Engine editor to re-build / re-load my changed code.

So, this works. Can you get back what you need this way? What’s different about what you’re doing?

1 Like

when you created a class look at the header files.
#include “XXfile/YY.h”
Delete the “XXfile/” code
#include “YY.h”
and probably it’s the solution

1 Like

I didnt cutoff the screenshot, thats where the outputs ended ended. But the plugin that is outputting a version error is the plugin i rebuilt on another project to bring it in to the main project. Rebuilding it went fine with no errors and I was able to use it in my project. When converting the project to C++ doing the exact way you did, I get those errors. To restate, the plugin was originally built for 4.26, I built it for 5.0, but when I used it in a project and converted the project to c++, it errored out.

But a seperate problem I have been having that I thought would be contributing to this is when i create any project as C++, it would just crash.

Also for the backups, I jsut have a main backup that is before the project is converted to C++, so I can just copy it again whenever I mess up or if it breaks in building. The project works fine when copied. And it was just copying it inside the backup folder don’t worry about that.

Alright, that sounds like something to debug first!
Create a new blank project, add a C++ class, deriving from Actor or BlueprintFunctionLibrary or something simple like that.
If that doesn’t work, figure out what those errors are, and if you can’t, post those errors for help.

Also, it’s generally better to copy the error text out of the console window, and paste using code tags in the forum, than to try to post screen shots. The reason is that Google won’t find the text in the screen shots, AND the screen shots can’t scroll to capture all of the text at once.

It works now, I don’t know why. So now the issue is the plugin. Should I rebuild the plugin again and try to migrate all the assets from my backup project with the new rebuild on a new project?

This did it for me! Thanks!