Issue Tracker

UE4 dependency issues with AIController

Link error:

error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl AAIController::AAIController(class FPostConstructInitializeProperties const &)" (__imp_??0AAIController@@QEAA@AEBVFPostConstructInitializeProperties@@@Z)

Add AIModule as one of the project dependencies in the Build.cs file.

iterator vector::end() returns funny result

So far this run-time error only happens in UE DevelopmentEditor environment. In a particular case, I used vector::find() to search for an element in a vector array. If it returned it = vector::end(), I pushed a new element to the end, and used std::distance(vector::begin(), it) to get the index of newly pushed element–it didn’t work I expected, even though it worked fine in debug mode. Didn’t figure out why. (VariableLoader.h)

Compile error: missing “;” before “*”

This compile error is likely due to the absence of proper namespace…weird.

Sometimes switching the build target between “DevelopmentEditor” and the others helps.

Raycasting fails to avoid owner

UE4 uses a Collision-Trace-Channel system for raycasting (and physical collision). Interestingly, the Collision property is not only applied to “colliders”, but everything with a mesh. In order for the raycasting to work properly, you need to set the Collision property for every mesh component correctly.

To avoid hitting the owner, first create a customized Trace Channel in Project Settings > Collisions > Trace Channels. Then set the Trace Channel to Ignore in the Collision property of each mesh of the owner. In code, the first customized Trace Channel is referenced as ECollisionChannel::ECC_GameTraceChannel1. This is the enum to feed into the LineTraceSingleByChannel function.

UE4 crashes when started but the project is complied successfully

Runtime error may be caused by multiple reasons. First thing is to check the Log–usually it will not show much by default. Try print debug messages to the Log and track down the problem.

Some tricky cases I have ran into are:

  • File path error / file cannot by loaded in runtime. VS2017 complies the code and saves it as binaries. So the relative filepath used in the code will be pointing to the wrong place. A better practice will be, since the data file loaded is an asset, to keep the file in the Contents/Data/ folder, and expose a Upropery in the Editor to get the filepath.
  • Dynamic casting. VS2017 hides the RTTI settings for UE4. You need to forcefully enable it in the Build.cs file.
  • Linking error. If there are cpp files in the static library imported, they may not be included in the build, even if it shows as imported. It is probably better to just have everything in the header files if it makes sense.
  • Runtime error. Usually due to initialization.

Compile fails / Cannot create MyUEProject.dll in VS2017

It may due to transferring files between systems. Delete everything under /Binaries and build again.

Undefined reference to vtable

Even though the compiler says “a missing vtable usually means the first non-inline virtual member function has no definition”…but usually it is not. The really error can be:

  • IDE fails to include cpp files. Or,
  • Forgetting a body on a virtual destructor. Or,
  • Other cases in this thread.

UE4 project creation / Compile errors

Having VS 2015 Community & VS 2017 Community installed.

  • Install C++ support for VS 2015. Create UE4 project as usual, then switch the external tool to VS 2017. Or,
  • Uninstall VS 2015 completely with this program. Don’t try to manually remove VS 2015 by yourself because there are many dependency files.

‘Visual Studio 2015 must be installed in order to build this target.’, ‘Windows SDK v8.1 must be installed in order to build this target.’

  • Install Game development with C++ with option : C++ profiling toolsWindows 10 SDKWindows 8.1 SDK and .NET Framework for VS 2017. (For some reasons, VS 2017 is called VS 2015. I wonder why.)
The AI Project