Create and use a plugin

Hi,

I want to create my plugin to use a Spacemouse Pro (3D mouse).
I have a lib (HIDAPI) to link.

However, I didn’t found how create and use a plugin.
I use UE4 : Edit->plugins->newplugin
And I have this code :

using UnrealBuildTool;

public class Plugin : ModuleRules
{
	public Plugin(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

		PrivateDependencyModuleNames.AddRange(new string[] { "SpacemousePro" });
	}
}

I include my plugin into a class :

#pragma once

#include "SpacemousePro.h"

#include "GameFramework/GameMode.h"
#include "Mouse3DGameMode.generated.h"

/**
 * 
 */
UCLASS()
class MOUSE3D_API AMouse3DGameMode : public AGameMode
{
	GENERATED_BODY()

private:
	FSpacemouseProModule sapcemouse;

public:
	AMouse3DGameMode();
	
	
};

And how use the function in my plugin ?
This kind of code FSpacemouseProModule spacemouse; generate a link error. (LNK2001: unresolved external symbol “public: virtual void __cdecl FSpacemouseProModule::StartupModule(void)” (?StartupModule@FSpacemouseProModule@@UEAAXXZ))

Regards,

Well your linker error is related to main module class. Maybe remove #include "SpacemousePro.h" from from that actor header. Usally this kind of link error comes up if you got function declered in header file but defined in code file

Absolutely not :s

The removing of the include create a error because the type is not know.

#pragma once

#include "GameFramework/GameMode.h"
#include "Mouse3DGameMode.generated.h"

/**
 * 
 */
UCLASS()
class MOUSE3D_API AMouse3DGameMode : public AGameMode
{
	GENERATED_BODY()

private:
	FSpacemouseProModule sapcemouse;

public:
	AMouse3DGameMode();
	
	
};

Ok put it back and place header files and cpp of main module class, because there problem there

Wait a sec… i just noticed that SpacemousePro and you PlugIn is sperate thing :stuck_out_tongue: Sorry for misunderstanding, now i understand might be wrong, i delete my previues comment to keep quaastion clean. How do you load or get SpacemousePro module? can you post AMouse3DGameMode cpp file?

I want to create the spacemousePro module. So I use UE4-Editor to create my plugin named spacemousePro.

My AMouse3DGameMode.cpp is empty :
#include “Mouse3D.h”
#include “Mouse3DGameMode.h”

AMouse3DGameMode::AMouse3DGameMode()
{

}