Description

Building the Engine in Visual Studio will fail due to an unresolved external symbol error if a new global variable is added to CoreGlobals.h and then referenced elsewhere in the Engine code. The build will only complete successfully if a full rebuild is performed.

Steps to Reproduce
  1. Open the UE4 solution in Visual Studio.
  2. Locate and open the CoreGlobals.h file.
    • Engine/Source/Runtime/Core/Public/CoreGlobals.h
  3. Add a new global boolean variable to the file.
    • eg: extern CORE_API bool GIsTestGlobal;
  4. Build the UE4 project.
  5. Once the build completes, locate and open the SceneComponent.cpp file
    • Engine/Source/Runtime/Engine/Private/Components/SceneComponent.cpp
  6. Locate the DetachFromComponent() function.
  7. Add an if check for the new global variable added in step 3.
    • eg: if (GIsTestGlobal)
  8. Build the UE4 project.

RESULT:
The build will fail with an unresolved external symbol error similar to the following

error LNK2001: unresolved external symbol "__declspec(dllimport) bool GIsTestGlobal" (__imp_?GIsTestGlobal@@3_NA)

EXPECTED:
The build completes successfully.

WORKAROUND:
Perform a full rebuild of the UE4 project.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-54967 in the post.

1
Login to Vote

Non-Issue
CreatedFeb 7, 2018
ResolvedFeb 15, 2018
UpdatedSep 27, 2018
View Jira Issue