x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Cannot include .generated.h but it exists

Hello,

I'm currently trying to add a custom module to my game, but I got a class in this new module that fails to compile because it cannot include it's generated.h file

Here is the header of the class :

 #pragma once
 
 #include "CoreMinimal.h"
 #include "GameFramework/GameStateBase.h"
 #include <map>
 #include "Kea/Characters/Components/HealthComponent.h"
 #include "EntityManager.generated.h"
 
 /**
  * 
  */
 UCLASS()
 class SKILLCASTERMODULE_API AEntityManager : public AGameStateBase
 {
     GENERATED_BODY()
 
 public:
     AEntityManager();
     std::map<int, AActor*> EntityMap;    
     void AddEntity(int, AActor*);
 };

This gives me this error :

 Cannot open include file: 'EntityManager.generated.h': No such file or directory


Product Version: UE 4.18
Tags:
more ▼

asked Jan 08 '18 at 04:56 PM in C++ Programming

avatar image

benjaml
26 5 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

I've succeed to correct this by adding the class through Unreal editor

more ▼

answered Jan 09 '18 at 10:35 AM

avatar image

benjaml
26 5 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2nd time writing this because the web server boned me...again.

Try rebuilding everything from scratch. If you don't know how, here it is:

  1. Exit the editor and back up the project (just in case)

  2. Delete these directories from your project folder tree: .vs, Binaries, Build, Debug, Intermediate, Saved

  3. Re-generate project files (right-click your uproject file and choose "Generate Project Files")

  4. Open the Visual Studio solution (YourProject.sln)

  5. Build your project for "Development Editor" (should be set already)

If that doesn't do it then post your CPP file too I guess.

more ▼

answered Jan 08 '18 at 05:09 PM

avatar image

Jin_VE
4.4k 32 77 42

avatar image Jin_VE Jan 09 '18 at 10:29 AM

Responding to below...

EntityManager.cpp is in the solution, getting built? Is it building EntityManager.gen.cpp? (It will only build it the first time, FYI.) Is there another error before the missing file error?

Does an unaltered C++ template project build OK?

If so, it must be how you're doing this custom module. The file isn't getting generated so something must be wrong there. You'll need to provide more details about the module and how you project is set up.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

It does not solve the problem.

Here is my cpp file :

 #include "EntityManager.h"
 #include "SkillCasterModule.h"
 #include "Kea/CLRService.h"    
 
 
 
 AEntityManager::AEntityManager()
 {
     PrimaryActorTick.bCanEverTick = true;
     EntityMap = std::map<int, AActor*>();
 }
 
 void AEntityManager::AddEntity(int id, AActor* actor)
 {
     EntityMap.insert(std::pair<int, AActor *>(id, actor));
     CLRService* service = CLRService::GetService();
     if (service)
     {
         HINSTANCE dllHandle = service->GetDllHandle();
         if (dllHandle)
         {
             IntParameterFunc func = (IntParameterFunc)GetProcAddress(dllHandle, "AddCharacter");
             if (func)
             {
                 func(id);
             }
         }
     }
 }
more ▼

answered Jan 09 '18 at 09:22 AM

avatar image

benjaml
26 5 5 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question