This is a bit of a strange one. Just as some context, I have only just started coding with C++ on UE5 after working with Blueprints for a little over a year so I am quite new to coding with C++ in this context.
I fear that the reason why I am encountering this error is due to me manually copying and pasting my project’s files to a different file location rather than a (probably existing) more professional approach.
The error messages I am encountering are as follows:
I would clean and rebuild my solution in visual studio but to no avail
try to just create a new C++ class but be met with the same error message
Strange thing is, I was able to make a C++ file to attach a perception system to my AI character’s head successfully before I backed up the file and it worked fine. And still, the code which I made for this perception system is still working properly even though it is giving me these errors in visual studio.
Does anyone have any ideas what may be causing this? I am open to giving any additional context if needed.
Try deleting the .vs folder, Source folder and the .sln file, open up your .uproject file, create a new C++ class (while you’re doing that you can as well make it public), then close the editor, navigate to the newly generated Source folder, then into the folder with your project’s name under the Source folder, and there you can replace the Public & Private folders with the original ones. Now you should be able to build your project just fine
Disclaimer: Always make sure to have a backup of your project before manually adjusting the project files!!!
So I’ve followed your directions to a tee but I still seem to be having the same kind of issue. I’ve removed the following folders:
.vs
.snl
Source
And then opened up the .uproject file and created a new C++ class. I closed Unreal and Visual studio and then replaced the original public/private folders from an older backup I have. After opening up my .uproject file, I still cannot go into my C++ class and select “build”.
I have also tried to just leave the new Source files that have been created when I make the C++ class, but still everything refuses to build. After doing a “Clear” and “Rebuild” in Visual Studio, I got the following error (Hopefully this helps narrow down what may be going on):
Create a new blank project, open up your current project by clicking on the .uproject file, migrate your assets to the blank project, replace the Public & Private folders in the blank project’s Source folder with the ones in your current project, and build your project via the new project’s .sln file?
You can migrate your desired assets by right clicking on them, navigating to the Asset Actions section on the menu that pops up, and selecting the Migrate option. You can also right click on a folder to migrate the assets inside as a whole!
I have tried a variety of things to get UE5 to let me create a class but boy has it been fighting me
I’ve tried your approach with creating a new project and migrating my assets to the blank project as you suggested, but it gave me the same type of error. I looked into the link you provided for the other solution to hopefully fix the issue, but it also gave me the same results.
I’ve even opened up a completely blank project, created a C++ class for an actor, and feel that I’ve narrowed down that whatever Issue I’m encountering may just have to do with either Unreal Engine or Visual Studio as a whole. When creating a C++ Actor class and reviewing all the error messages/Errors, they end up looking like this:
Everywhere that these errors exist in the code are places which I have never seen nor touched before which is quite strange.
To try and fix this issue, I’ve done the following:
Verified all files for Unreal Engine 5.4 via the Epic Launcher
Rolled Visual Studio to a slightly older version (apparently newer versions can cause issues from what I found)
Created several new blank projects to try and get a C++ class working
verified that I have all necessary packages to code in C++ in visual Studio Installer
Still, nothing seemed to work. At the moment I’m just not sure what to try next. Everything else in Unreal engine works fine, I can run Blueprints and debug my game no problem as long as I don’t do anything related to C++ Classes.
Thank you again for all the assistance you have provided thus far. I feel we’re narrowing down what may be causing issues but I’m curious what ideas you may have to fix these issues.
And when you talk about the home tab of VS, I assume you are talking about this one correct? The only thing that Visual studio is giving me warnings about is the Naming convention Checker as well as the HLSL support:
I’m going to continue to try and debug this solution throughout the day. If I can’t get it to work, I guess I’ll have to go nuclear as you suggested haha. I’ll keep you updated how it ends up working out for me
Thank you again for the continued help!
@tootzoe1, thank you for this reference as well! There were a couple of things here that I’d never seen before so that was pretty cool. Sadly I didn’t really see anything to help solve my issue but thank you for the suggestion.
I’ve tried everything. Uninstalling and reinstalling both Visual Studio and UE5 (as well as verifying both of them too and giving them admin rights) but when I start up visual studio, I am haunted by these 4 error messages lol:
I just want to list a couple of things that I’ve noticed while trying to overcome this issue:
these 4 errors listed above are consistently showing up regardless of what I do
I’ve noticed that whenever building, rebuilding, or clearing in Visual Studio, I am receiving the message that there 1 skip and it’s always this same line of code:
I want to apologize for the delayed response, I’ve been away from my computer for the past few days due to recovering from an eye surgery (everything is okay )
But now that I’m back, I’ve gone back to try and pinpoint what may have been causing this issue and it seems that being uneducated on how Unreal interacts with Visual Studio was the culprit. This whole conversation, I was under the impression that when working on my project, I need to select the “Build” option when adding my coding changes to Unreal Engine 5. What I was not aware of, is that when pressing ctrl + alt + F11, Unreal engine 5 would sync my visual studio changes to UE5.
To test if this feature is working, I have coding the following logic to work as a “print string” node would:
If you look in my first screenshot, I still see these error messages which is quite strange I feel, but now I know that any changes being made in Visual Studio are properly being transferred to UE5.
Does this look good on your end as well?
And thank you soo much for everything! It seems that your last reply asking if I’m trying to build my project while the .uproject file is open snapped me out of my trance lol.