Linking 3rd party SDK library / developing plugin. Need help with the setup

BTW Getnamo’s Razer Hydra plugin has a decent example of how to use third party libraries in a plugin project, and the build scripts involved in that. Apologies if this isn’t helpful at this point, I haven’t read over the thread closely to see what point OP is at.

Sorry about the lack of responses. Was off the grid for a week.

Oh that would be great. I’ll send you a link via PM.

It does look helpful! I rely a lot on these sort of examples to get a grasp on how everything is supposed to work. Problem is, if it still doesn’t work, I barely have a clue what I could be doing wrong and end up swapping files around for hours.

Hi, I am looking at doing a very similar project at uni, using the Vicon motion capture system with ue4 and the oculus rift.

I’m more of a designer/3d artist and have zero knowledge of c++ and was initially hoping for plugins to do most of the work.

I was wondering how you’ve progressed?

Oh I did see Pegasus Pegasus | Vicon Motion Capture Retargeting Software but I’m having a lecturer look into the price and funding…

I am also around for help on this matter. I admit that the linking tutorial isn’t the simplest, but its had quite a lot of readers and other plugins come along based on it (at least of the couple dozen that have GitHub visible projects). If you are running into issues with it I’m always interested in improving things.

Having problems with vicon datastream sdk 1.4

Hi,
first of all I have to mention that I’m new to c++ but within my course of studies I have gained some experiences with programming.
Currently, I’m working on a plugin for a datastream between vicon blade 1.7 and unreal engine 4.4.3. This should be done by using the Vicon Datastream SDK v 1.4 which contains a header file, a library and a .dll file.

Right now, I’m having problems with compiling my basic plugin.
The Vicon DataStream SDK was build within an older version of visual studio than 2010. So I want to know if there is any possibility to go on working with the vicon sdk in visual studio 2013? Should I force the sdk to use the latest .dll in visual studio and if so how do I do that?

I already tried to go on working with the sdk ignoring the problem I’ve mentioned before.
When I built the project without changing the header file of the sdk I’m getting this error:

Error 2 error C2059: syntax error : ‘constant’

Here are the affected rows:


#ifdef WIN32

 

#ifdef _EXPORTING

   #define CLASS_DECLSPEC    __declspec(dllexport)

#else

   #define CLASS_DECLSPEC    __declspec(dllimport)

#endif // _EXPORTING

 

#elif defined( __GNUC__ )

 

#if __GNUC__ < 4

  #error gcc 4 is required.

  #endif

  #define CLASS_DECLSPEC     __attribute__((visibility("default")))

 

#else

 

#define CLASS_DECLSPEC

 

#endif

 

#include <string>

namespace ViconDataStreamSDK

{

       namespace CPP

       {

       ...

       }

}

If I redefine the second namespace to ‘UCPP’ I’m getting a huge list of errors like this one:
Error 2 error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl ViconDataStreamSDK::UCPP::Client::Client(void)”

I think it’s because CPP is already defined in unreal engine but because of the dependency of the header file to the .dll file in the sdk the definition of the namespace is unchangeable in the sdk.
Is that expectation correct or am I on the wrong track?

Hi,

I am trying to do the exact same at the moment and also ran into this error.
The problem is that Unreal Engine 4 has a #define for “CPP”, I think in core.h (ouch).

So what I just did to make it compile was to insert an #undef CPP into the Vicon header file before the namespace starts.

This way, it definately compiles and links but I havent tested anything further yet. Hope that helps though!

I think #undef CPP is the best step forwards, I’m afraid. The fact we define a CPP macro is an unfortunate coincidence (though I admit - it’s probably not a great choice of name on our part). We can probably look at renaming it if this isn’t a one off, but we’re always wary of spoiling backwards compatibility with other UE developers.

Hi,

thanks for your help, it worked!:slight_smile:
But now I’m getting errors for linking the third party.

it says:
Error 2 error LNK2019: unresolved external symbol …

40 Times and :

Error 41 error LNK1120: 39 unresolved externals …

If I add following line to my build file visual studios put out another error:

here’s the line I’ve added:


    public DataStream(TargetInfo Target)
        {
          Type = ModuleType.External;
           ...
         }

and the errors I get:

Error 3 error LNK2001: unresolved external symbol _DllMainCRTStartup …
Error 4 error LNK1120: 1 unresolved externals …

Here are my paths:

.lib file of the sdk: \Plugins\DataStream\ThirdParty\Vicon\Libaries
.h file of the sdk: \Plugins\DataStream\ThirdParty\Vicon\Includes
.dll file of the sdk: \Plugins\DataStream\Binaries\Win64

Do the third party need to have it’s own build.cs file? When I started programming that is what I’ve done but an acquaintance
told me that it’s not necessary so I deleted the build.cs file within my third party folder.

A third-party library doesn’t need a Build.cs file, but it’s much easier if it does have one, because then you only need to specify header and lib paths once, rather than set those paths up in the Build.cs of each module you want to use that library in. In any case, I have no idea what you’ve actually done at this point, you said you’ve removed the Build.cs from the third party folder, so where is the code you’ve pasted above located? Is it in your game module? That could explain the unresolved externals, since ModuleType.External tells UBT the module should not be built.

okay now here are the paths I’ve got:

Plugins\DataStream\Binaries\ThirdParty\ViconDataStreamSDK_CPP.dll
Plugins\DataStream\Source\DataStream\Private\DataStream.cpp
Plugins\DataStream\Source\DataStream\Private\DataStreamPrivatePCH.h
Plugins\DataStream\Source\DataStream\Public\DataStream.h
Plugins\DataStream\Source\DataStream\DataStream.Build.cs
Plugins\DataStream\ThirdParty\Vicon\Includes\Client.h
Plugins\DataStream\ThirdParty\Vicon\Libaries\ViconDataStreamSDK_CPPx64.lib

first I had an error saying CPP is already defined.
After solving that problem I got a problem with linking the dll file.

I guess my question is how to link the dll within my DataStream.Build.cs?

(here’s the complete build.cs file namespace UnrealBuildTool.Rules{ using System.IO; public class DataS - Pastebin.com)

Well, at least my acquaintance told me that I have to do that within my build.cs file. I have just seen another plugin where the programmer programmed a cpp. file just for loading his dll file.

The LIB file is the import library for the DLL, so you need to link against that. What happens when you add…

PublicLibraryPaths.Add(LoadViconLib)

…to your LoadViconLib() function?

thank you for your help! :slight_smile:

But still getting the same bunch of errors like this one

Error 2 error LNK2019: unresolved external symbol “__declspec(dllimport) public: __cdecl ViconDataStreamSDK::CPP::Client::Client(void)” (_imp??0Client@CPP@ViconDataStreamSDK@@QEAA@XZ) referenced in function main

Ah, sorry - adding the PublicLibraryPaths.Add() line is enough to add the Vicon directory to the library search paths, but then you have to add the actual library!

            PublicAdditionalLibraries.Add("ViconDataStreamSDK_CPPx64.lib");

I notice too, that the library path in your .build.cs file doesn’t match the directory you mentioned above (“Plugins\DataStream\ThirdParty\Vicon\Libaries”):

            string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x32";
            string LibrariesPath = Path.Combine(ThirdPartyPath, "ViconDataStreamSDK", "Lib");

Shouldn’t that be:

            string LibrariesPath = Path.Combine(ThirdPartyPath, "Vicon", "Libraries");

?

The Problem is that there is no entry point.
As I mentioned the SDK is an older Version (2009) so the entry point which is given is different from what is expected. :confused:

Has anyone achieved this?

I have a plugin that works in the editor, but when I try to package it with a project I get a message saying the dll is missing. I am packaging a code project for 64bit.