How to Finish Linking Qt5 .dlls?

I have been jumping through numerous hurdles to get up to this point, and being right on the verge of having it, I would quite like if somebody could help me finish linking these Qt .dlls.

Following a couple of the different Linking tutorials scattered around the internet (1, 2, 3), I’ve managed to get by the common initial hurdles. For posterity, here’s the quick general rundown of everything I’ve done up to this point:

  1. Either create your .dll and .lib files, if you’re building them yourself, or locate them wherever they are,
  2. Place all .dll and .lib files that you intend to link with into your project’s /Binaries/{system architecture} folder, alongside the regular project .dll and .lib,
  3. In your VS solution, make sure to add the location of your .dll and .lib files’ include files directory to anywhere that it is necessary (Include Directories under VC++ Directories and Include Search Paths under NMake),
  4. #include the necessary files, smoothing out any compiler issues that crop up.

You’re now at the point where I’m at, mere moments away from being able to use whatever it is that you’re trying to link with.

Even now, however, there are some odd occurrences. Firstly, when following one of the tutorials linked to above, they have you create a basic .dll (and .lib) in VS, then have you expose those to blueprints, although in a rather nasty way. That obviously wasn’t going to work with how expansive Qt is, so I tried combining that basic .dll with Rama’s solution, and after a few basic syntax errors cleaned up, it worked right out of the gate.

So, there has to be some difference between the Qt .dll files and my own, since mine worked without a hitch.

Now, onto the actual description of the error I’m facing:

The ■■■■■■■ that makes me hate everything

This error is specifically caused by any usage of Qt throughout my current Project. In particular, these are the currently offending lines:

// Called every frame
void ABP_DLLBoy::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
    QString wow = "Hello, world!";   // << this guy <<
    if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Red, FString::FString((char*)wow.data()));  // << this guy too <<
    if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Red, FString::Printf(TEXT("%f + %d = %f"), 5.5f, 10, MathLibrary::Functions::add(5.5f, 10)));
}

Intellisense (for once) isn’t exploding, so it is able to locate and recognize QString and its functions, and, just for good measure, the second Debug Message is the result of another .dll that I threw together that doesn’t need to be commented out for the Editor to run.

When those two lines are commented out, the Editor runs after a build without a problem. If, while the Editor is running, I uncomment and build with those two lines, the Editor actively removes the Compile button as soon as the build is complete.

I’m at wit’s end on this issue, and would really appreciate if anybody has navigated this maze before and has the answer, or if somebody can conclusively prove that UE4 is incapable of linking certain .dll and .lib files in this way, and if there is an alternative that isn’t going to cause my to tear my hair out any further.

Thanks ahead of time!

Well, in less than a day of further digging, I have determined the problems, and, as of now, I am able to use Qt5 linked with UE4.

The solution was within debugging - more particularly, starting a new instance of the Project, and then staring at a wall of Debug Output text for half an hour. A bit of soul-searching later, and I came across a few .dll’s that QCored.dll needed and, after adding them in (4 of which were located in System32, oddly enough) the Editor is now able to run and the QString is properly interpreted and printed.

All-in-all, it was hell to deal with, but if anybody is having a similar issue to this, the solution lies, sometimes, in finding out why the OS isn’t able to load one of your .dll files. Debug your projects - it’s tedious, but worth it in the end.