I’ve been using the engine for a while, mostly learning what it has to offer and how to use it. What I have noticed is that I often get strange errors from seemingly working code. This happens usually when I want to create new files or add includes to files.
I may move a file to another location after having created it and suddenly I get errors that the file may be missing. Sometimes a duplicate of the file seems to be created where the original was before I moved the file.
Another case I had just now was when I created a new header file and then added an empty class as the following:
class UTestClass : public UObject
It compiled fine just as it should. I then proceeded to delete the source file which gave an error that the source file could not be found which is also reasonable. Next I deleted the class from it at which point only the #pragma once and #include “TestClass.generated.h” were left and now I got the c1083 error with no such file or directoy. Following this I pressed ctrl+z to undo it and compiled again. You would now expect that I would again get the error that the source file is missing but no. Now it sticks with the c1083 error. After this I removed it again and now replaced it with a struct like the following:
Now it suddenly compiles just fine with no errors.
On another occasion yesterday I suddenly got some unauthorizedaccess exception on some file which I don’t remember the name of that wouldn’t go away. Finally after trying different things I ended up deleting the Binaries/build/Intermediate folders and used the .uproject file to regenerate visual studio files and the open up VS after which it compiled without any problem.
Earlier as well I created a header file without any source file and added several USTRUCTs and UENUMs to it. It worked fine and I could use them as function parameters in other classes. However the moment I used a UFUNCTION(BlueprintCallable) macro on a function with a struct in it I got the “OtherCompilationErrors(5)” or something like that. I figured it might happen because I had multiple utypes in same file and so I split them up into separate header files. However after this each file gives the c1083 error saying the Cannot open include file: … . No such file or directory.
From what I have experienced I tried just for “fun” to put things back how they were again with the structs and enums in one file again and removed the UFUNCTION macro. The c1083 is still there and not only that every new header file I create gives the error regardless of what I add to it or where I place it. I am still stuck at this right now.
I’ve usually gotten by either by deleting a file completely and created a new in the proper place or as mentioned deleting the Binaries/build/Intermediate but I have become really tired of all this and so it has let me to create this messy post.
I was wondering if others are getting errors like these regularly and if there are any ways of addressing them properly without having to delete folders? I may be missing out on something or not understand something properly.
Would appreciate if somebody could enlighten me thanks.
#UE Version 4.9.2 (download/install with EG launcher) - VS2013 prof
Bear in mind that Unreal manages your project NOT Visual Studio. Anytime you change what files are in your project or where they are located you absolutely should regenerate the project files before continuing or else you are in for a world of hurt. Additionally Unreal does a lot of preprocessing stuff on your files and especially headers, before compilation even begins so that is also a potential problem point if you don’t have everything just right.
For this specifically, there are some rules on how enums have to be handled in order to be properly exposed to the Reflection system. Do some searching in the docs, I don’t recall the specifics off the top of my head.
C:\WINDOWS\system32>"“C:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat” ThirdPersonEditor Win64 Development “E:\Unreal Projects\ThirdPerson\ThirdPerson.uproject” -rocket"
‘""C:\Program’ is not recognized as an internal or external command,
operable program or batch file.
I’m not familiar with cmd usage as I hardly ever need to touch it but I assume I need to write something beforehand? Like you use Start “…” when starting a process?
Drop the outside set of quotes so that it looks like:
“C:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat” ThirdPersonEditor Win64 Development “E:\Unreal Projects\ThirdPerson\ThirdPerson.uproject” -rocket
This is really nice. Have had trouble with it before and not knowing the exact problem. Have usually figured it out but this makes it much easier.
For these problems it was as I had suspected with the enum. It has to be one of the two others that does not use the namespace thing. As for the UFUNCTION() it did not recognize the FLoadMapParams as a struct. I remembered something about filenames I read a while back so I changed the file name to be identical to it and it works now.
It is quite annoying you have to make a new file for each enum/struct you have if you want to use them in UFUNCTIONS. The funny thing is before I used the UFUNCTION and had them both in same file I could still use them in blueprint.