Include "Net/UnrealNetwork.h" doesn't compile

Hi,

I just got this error while using the 4.7p8.
I wanted to make a UProperty replicated, but sadly it doen’t compile when I have included the “Net/UnrealNetwork.h”.

This is the output I get after trying to compile:

1>------ Build started: Project: PRF, Configuration: Development_Editor x64 ------
1>  Compiling game modules for hot reload
1>  Performing 2 actions (4 in parallel)
1>  BasicItem.cpp
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(78): error C2653: 'FLogCategoryLogNet' : is not a class or namespace name
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(78): error C2065: 'CompileTimeVerbosity' : undeclared identifier
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(78): error C2065: 'LogNet' : undeclared identifier
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(78): error C2228: left of '.IsSuppressed' must have class/struct/union
1>          type is 'unknown-type'
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(78): error C2228: left of '.GetCategoryName' must have class/struct/union
1>          type is 'unknown-type'
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(78): error C2665: 'FMsg::Logf' : none of the 2 overloads could convert all the argument types
1>          e:\program\epic games\4.7\engine\source\runtime\core\public\Misc/OutputDevice.h(383): could be 'void FMsg::Logf<const TCHAR*,const TCHAR*,const TCHAR*>(const ANSICHAR *,int32,const FName &,ELogVerbosity::Type,const TCHAR *,T1,T2,T3)'
1>          with
1>          [
1>              T1=const TCHAR *
1>  ,            T2=const TCHAR *
1>  ,            T3=const TCHAR *
1>          ]
1>          while trying to match the argument list '(const char [82], int, ELogVerbosity::Type, const wchar_t [83], const TCHAR *, const TCHAR *, const TCHAR *, const TCHAR *)'
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(85): error C2653: 'FLogCategoryLogNet' : is not a class or namespace name
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(85): error C2065: 'CompileTimeVerbosity' : undeclared identifier
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(85): error C2065: 'LogNet' : undeclared identifier
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(85): error C2228: left of '.IsSuppressed' must have class/struct/union
1>          type is 'unknown-type'
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(85): error C2228: left of '.GetCategoryName' must have class/struct/union
1>          type is 'unknown-type'
1>E:\Program\Epic Games\4.7\Engine\Source\Runtime\Engine\Public\Net/UnrealNetwork.h(85): error C2664: 'void FMsg::Logf(const ANSICHAR *,int32,const FName &,ELogVerbosity::Type,const TCHAR *)' : cannot convert argument 3 from 'ELogVerbosity::Type' to 'const FName &'
1>          Reason: cannot convert from 'ELogVerbosity::Type' to 'const FName'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>  -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: E:\UE4Projects\PRF\Binaries\Win64\UE4Editor-PRF-5860.dll
1>  Cumulative action seconds (8 processors): 0,00 building projects, 0,11 compiling, 0,00 creating app bundles, 0,00 generating debug info, 0,00 linking, 0,00 other
1>  UBT execution time: 4,01 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""E:\Program\Epic Games\4.7\Engine\Build\BatchFiles\Build.bat" PRFEditor Win64 Development "E:\UE4Projects\PRF\PRF.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This is my file:

// Fill out your copyright notice in the Description page of Project Settings.

#include "PRF.h"
#include "BasicItem.h"
#include "Net/UnrealNetwork.h"

// Sets default values
ABasicItem::ABasicItem()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	bReplicates = true;

}

// Called when the game starts or when spawned
void ABasicItem::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void ABasicItem::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

Is it me just being stupid and tired, has something changed in the 4.7 or simply a bug in the preview? :slight_smile:
I searched for it but found nothing.

Best regards
//Oscar

Have a look at this answer:

Basically, you’re missing some important logging includes. There is probably a better choice, but check if adding

#include "Engine.h"

works to verify.

Worked for me. Thanks :smiley:
Certainly a completely misleading bundle of errors. In fact I would expect UnrealNetwork.h to handle that seeing it’s code in UnrealNetwork.h that needs the include in the first place.