Announcement

Collapse
No announcement yet.

"New C++ Class" not adding file structure or .generated.h to project

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    "New C++ Class" not adding file structure or .generated.h to project

    Over the past year or so I have created and abandoned dozens of projects. Each time I setup a new C++ project it is a NIGHTMARE. That is why I abandon so many of them. Just getting the engine to configured at the start of a project exhausts me.

    Anyways, the problem I am having now (for the nth time) is that I cannot add new C++ classes to my project because unreal is not generating the .generated.h header files. I think the fact that my classes do not show up in the editor is a side effect of this, but I'm not sure.

    I have tried everything I can think of. Deleted the binaries. Deleted all the file structure and started over, included recreating the classes I had made. compiling the code in and out of the editor, a dozen times.

    I have spent so many hours (now and in the past) just trying to get the engine to compile the most basic C++ classes that I am nearly to the point of asking Epic to pay me for my mental health.

    Does anyone know what I can do to do my classes to generate .h files?

    Thank you.

    #2
    The .generated.h files are created by UHT when you build the project, they are not created manually or when you create a new CPP/H file.

    They are also only created for headers which actually have reflected types in them, such as UCLASS, USTRUCT or UENUM - and should therefore only be included in headers which have items like that in them. Intellisense doesn't understand any of this so will constantly spew out bogus errors about missing files, but they can be ignored. This is also why Epic recommends disabling the VS 'Error List' entirely - since it's usually just full of things you can ignore.

    Deleting binaries and regenerating solution files will not solve anything here as there is nothing to solve. If you have a reflected type declared in a header, you add the .generated.h include to the top. That's all you need to do.

    Comment


      #3
      Thank you for the reply.
      You wouldn't happen to know why the new classes aren't showing up in the editor would you?

      Comment


        #4
        Are you creating new class within the Unreal Editor as this creates everything you need? I've never had any issues with .generated.h not being created correctly.
        -------------------------------------------------
        [Marketplace] Worn Furniture Pack 1
        -------------------------------------------------
        [Marketplace] Beach Props Pack 1
        -------------------------------------------------

        Comment


          #5
          Yes I learned a while ago I have to use the editor to create my .h/,cpp files.
          I started with the top down template. The first thing I did was create a player controller and a character in a folder called player. They worked fine.
          From that point on all my files have been "none" parent class. These files do not generate .generated files nor do they show up in the editor.

          Thank you for your reply.

          Comment

          Working...
          X