I Cant build my 4.9 project using xcode 6.4

When i tried to build my project using xcode. It gave me this error:

ExternalBuildToolExecution BatteryGameEditor\ -\ Mac
    cd /Users/Shared/UnrealEngine/4.9
    export ACTION=
    /Users/Shared/UnrealEngine/4.9/Engine/Build/BatchFiles/Mac/RocketBuild.sh BatteryGameEditor macosx DebugGame /Users/stefanjakobsson/Documents/Unreal\ Projects/BatteryGame/BatteryGame.uproject
Building BatteryGameEditor...
Creating makefile for BatteryGameEditor (no existing makefile)
Compiling with MacOSX SDK 10.10
Parsing headers for BatteryGameEditor
  Running UnrealHeaderTool "/Users/stefanjakobsson/Documents/Unreal Projects/BatteryGame/BatteryGame.uproject" "/Users/stefanjakobsson/Documents/Unreal Projects/BatteryGame/Intermediate/Build/Mac/BatteryGameEditor/DebugGame/UnrealHeaderTool.manifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -rocket -installed
/Users/stefanjakobsson/Documents/Unreal Projects/BatteryGame/Source/BatteryGame/Battery.h(26) : Expected an include at the top of the header: '#include "Battery.generated.h"'
Error: Failed to generate code for BatteryGameEditor - error code: OtherCompilationError (5)
UnrealHeaderTool failed for target 'BatteryGameEditor' (platform: Mac, module info: /Users/stefanjakobsson/Documents/Unreal Projects/BatteryGame/Intermediate/Build/Mac/BatteryGameEditor/DebugGame/UnrealHeaderTool.manifest).
Command /Users/Shared/UnrealEngine/4.9/Engine/Build/BatchFiles/Mac/RocketBuild.sh failed with exit code 5

Ive got no idea what to do. Hope that someone can help me.

Hey DrPelle-

The error message is saying that the compiler can’t find the include statement for Battery.generated.h. This is most likely due to the include not being positioned properly. For any “.generated.h” include statement, the include has to be the last one listed. If you have other include statements below Battery.generated.h then you will need to put them before it.


Doug Wilson

I checked all my code and saw that there was no statements like these. But the error is still coming.

Could you post the code for your project, specifically the Battery class files? It would probably be easiest to upload the project to dropbox and then send me a PM on the forums with a link to download it if possible.