New functions/variables not showing up. Can't compile from editor

I’m having two problems that have come up recently. I needed to add two new functions to my CPP class (One of them accessible to blueprints, the other one is not) but the function is not showing up in my project at all. I’ve also tried creating a variable that is also not showing up. Both of these are being created and declared correctly in my project, but neither one are showing up.

When I compile from within Visual Studio, I don’t get any errors. HOWEVER, when I compile from within the Unreal Editor, it errors out and all the errors are related to the Unreal generated files.

The errors themselves either point to the GENERATED_BODY() lines in my code files, or they’re pointing to the *.generated.cpp files. What gives? I didn’t write ANYTHING within these, so how come they’re erroring out? Granted, it’s been a while since I’ve had to update my CPP code for anything and there have been a few problems on my system between then and now, but everything else works fine.

I’m looking for ANY help with this, as my AI logic is at a standstill until I get this sorted out. I’m a programmer, not a configurator, so if there’s a configuration problem somewhere, I have no idea where to even begin to look for it.

HELP!

Hi ,

Not easy to answer with so few information.
Is your generated.h is the last #include ? If not, for sure it will throw an error.
If it is the case, you may have a problem with a duplicate #include in both .h and .cpp or an #include not used in your .h but needed in .cpp, or the inverse.

You could try rebuild the visual studio project too

Cheers

Include files seem fine. This is what I have.

My Labyrinth.h has:
#include “GameFramework/Actor.h”
#include “Labyrinth.generated.h”

Labyrinth.cpp has:
#include “LabyrinthLarry.h”
#include “Labyrinth.h”

Everything used to work just fine when I originally programmed the class. But recently I’ve needed to add some new functions to it and had this problem.

I don’t understand why it compiles okay through VS, but no changes show up in the editor (even after complete reloads), but gives me errors when using the “compile” button from the editor. Makes me think there’s a configuration problem somewhere, but I have NO idea where to look. Everything seems to point to the correct files in my project directories. Are there any temporary or cache files I can delete to try to refresh? I’ve already rebuilt the project in VS and also used the “Refresh Visual Studio Project” menu item in the UE File menu.

Ok, strange bug, what you can do is:

  • Try to undo your last modifications, recompile step by step, and look when this bug happen.
  • You can also try to delete your cash files, ( ! make a backup of your entire project before doing this ! ) I had some problems with cache for shaders, but i think it is the same place to delete, you have to delete the content of “Intermediate” and “saved” folders of your project, there is also some cache in your appData folder like this ‘D:\Users\yourusername\AppData\Local\UnrealEngine\4.10’ this can be different for you.

I am not sure if that’s all for the cache, the help of an Unreal guy would be welcome.

An other thing, when you create a new c++ class, you do it in unreal editor or VS? I am not sure that unreal create assets from class created in VS (I can’t verify, i use QTCreator)

The class was initially created in UE. It was one of the first classes created at the beginning of my project many months ago. I haven’t needed to make any changes until recently. I have a new enemy type, but they have to get access to dynamic data generated from this class in a specific way, so I’m creating a new function to build the custom array that each member of this new enemy class will need.

Anyway, I’m going to copy my project and try deleting a bunch of stuff. I am scared to uninstall and reinstall since the current preview release is different than the one I’m using so I’m afraid that if I try to upgrade my project, it won’t compile and I’ll be stuck.

(Yes, I know… And I didn’t INTEND for my project to be moved to a preview release, but it just kinda happened one day and there wasn’t much I could do about it anymore.)

I’m marking your answer as correct as I was able to fix this by deleting my Intermediate and Saved folders, but then I had to go back and do the File->Refresh Visual Studio Project from the Unreal Editor. (Though, I was able to successfully compile from the editor without doing this, I couldn’t compile from within VS until I did this… It complained about the Project Files not being found.)

Whew! Thanks! Now I’m able to focus on why I’m not getting the Data into the Array that I needed this function to fill for me. LOL! If it’s not one thing, it’s another, right?

Yeah! i am happy that it helped you!

Yes! it’s what is fun with programming.

Cheers :slight_smile: