Editor 4.9 C++ Lnk 2005 Errors. Strategy Game Code Clone Wont Build

Hi, I’ve just spent a few days trying to get the StrategyGame code migrated to new project. The purpose of the exercise is to gain some familiarity with c++ and the UE4 libraries. I’ve just about completed the migration, and now two things happen.

  1. The compile button has disappeared???
  2. Lnk 2005 errors, for the exact same code that is in the StrategyGame.
    I’m working with UE4.9. Visual Studio 2013 Community Edition. The original code builds fine.
    NB. I’ve made minor changes to file names so while learning the code (e.g. Building is now BuildingActor, etc).

Any help with this would be great.

I can’t see the top of WorldGame.h is a #pragma once present there?

Yes, its on line 3. Currently checking all source files now.

The interface ICoreTeamInterface does not have any BluePrint interaction, whereas ICoreInputInterface and ICoreSelectionInterface both house BlueprintNativeEvent Functions. As ICoreTeamInterface is the only interface that is not generating Lnk2005 errors, is it possible that some of the Thunking that takes place in the background is not resolving?

Any Help would be greatly appreciated.

Ok, its finally compiling.

The primary change appears to be making the UInterface definition Blueprintable, and the Interface definition GAME_API:

#pragma once
#include "CoreInputInterface.generated.h"

UINTERFACE(Blueprintable)
class UCoreInputInterface : public UInterface
{
	GENERATED_UINTERFACE_BODY()
};

class WORLDGAME_API ICoreInputInterface
{
	GENERATED_IINTERFACE_BODY()

	/** receive input: tap */
	UFUNCTION(BlueprintNativeEvent, Category = "Training")
	void OnInputTap();

	/** receive input: hold */
	UFUNCTION(BlueprintNativeEvent, Category = "Training")
	void OnInputHold();

	/** receive input: hold released */
	UFUNCTION(BlueprintNativeEvent, Category = "Training")
	void OnInputHoldReleased(float DownTime);

	/** receive input: swipe update (world space, not screen space)*/
	UFUNCTION(BlueprintNativeEvent, Category = "Training")
	void OnInputSwipeUpdate(const FVector& DeltaPosition);

	/** receive input: swipe finished (world space, not screen space) */
	UFUNCTION(BlueprintNativeEvent, Category = "Training")
	void OnInputSwipeReleased(const FVector& DeltaPosition, float DownTime);
};

This is different to what’s in the original StrategyGame, but it appears to be targeting 4.2 and not 4.9 (I might be mistaken on this):

{
	"FileVersion": 3,
	"Version": 0,
	"VersionName": "0.0",
	"EngineVersion": "**4.2.0-2092659+++depot+UE4-Releases+4.2**",
	"PackageFileUE4Version": 363,
	"PackageFileLicenseeUE4Version": 0,
	"EngineAssociation": "{69747498-44C5-A361-74CF-4C827BDB3E78}",
	"FriendlyName": "",
	"Description": "",
	"Category": "Samples",
	"CreatedBy": "",
	"CreatedByURL": "",
	"Modules": [
		{
			"Name": "StrategyGame",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		},
		{
			"Name": "StrategyGameLoadingScreen",
			"Type": "Runtime",
			"LoadingPhase": "PreLoadingScreen"
		}
	],
	"EpicSampleNameHash": "2647008642"
}