0

EDIT: Updated post to avoid linking to third party sites and to collect all required information here.

Any information is appreciated. If you need more info, please inform me and I will edit the post with the new details. Here is some useful information to start with.

Errors.

Source code.

I am trying to use a third party SDK consisting of one lib file and essentially one header file. I manage to get the intellisense to work, but I get linker errors even though I have modified my project's build.cs file to add the library path.

public OculusTest(TargetInfo Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
        // Add static libs
        PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "RPLidar/Libraries", "rplidar_driver.lib"));
        // Add a path with the .h that has the function definitions
        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "RPLidar", "Includes"));
    }

I also checked if I was missing something, but in a standalone C++ project I use the same files and only the same files and it does work. The files in question are

RPLidar.h and rplidar_driver.lib

As such I assume the error is in me failing to tell the Unreal compiler where to find the lib file.

Thank you in advance for all information regarding this way too stubborn error.

Noobs DeSroobs
  • 253
  • 1
  • 6
  • 24
  • 1
    possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – sashoalm Feb 02 '15 at 15:44
  • It should not be a duplicate because I do not want to know what an unresolved external symbol linking error is nor what might cause it from a C++ perspective. My question is how to link a library with an UE4 project. – Noobs DeSroobs Feb 02 '15 at 15:49
  • Your question should be as self contained as possible, referencing external sites is discouraged as they are not guaranteed to remain available. Your reddit post may disappear at any point in the future. – sjdowling Feb 02 '15 at 15:51

1 Answers1

1

I finally found my error.

After checking that the same version of VSC++ was used to compile both programs and that I checked that it was in the correct configuration I changed one extra thing that made it all work out.

Instead of compiling to a multi threaded LIB file, I compiled the code as a DLL file. I did it by opening the LIB project properties and going to C/C++ -> Code Generation -> Runtime Library and setting it to Multithreaded DLL (/MD). Under General I set the configuration type to be a static library (.lib).

Noobs DeSroobs
  • 253
  • 1
  • 6
  • 24
  • This helped me for a similar problem: I had a 3rd Party library (with DLL) included in a project, which acts like static library by itself. This library gave me some Linker 2019 errors, even though everything was there (and I compiled the 3rd Party library by myself without any problems). Changing my projects compile flag from /Mtd to /MD solved it. – DuKes0mE Oct 14 '16 at 15:05