LNK2001 unresolved external symbal "wchar_t"

So basically when building from UE source release branch at v 5.4.1 (fork(with no changes syncd to main)) I get the following errors, this on VS 2022 Pro 17.10, any ideas how to fix, alas double clicking the error does not take me to the code so bit confused ?

In the Output :
96>Building CmdLink…
03:39:41:476 96>Using Visual Studio 2022 14.38.33138 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130) and Windows 10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10).
03:39:41:476 96>[Upgrade]
03:39:41:476 96>[Upgrade] Using backward-compatible include order. The latest version of UE has changed the order of includes, which may require code changes. The current setting is:
03:39:41:476 96>[Upgrade] IncludeOrderVersion = EngineIncludeOrderVersion.Oldest
03:39:41:476 96>[Upgrade] Suppress this message by setting ‘IncludeOrderVersion = EngineIncludeOrderVersion.Latest;’ in CmdLink.Target.cs.
03:39:41:476 96>[Upgrade] Alternatively you can set this to ‘EngineIncludeOrderVersion.Latest’ to always use the latest include order. This will potentially cause compile errors when integrating new versions of the engine.
03:39:41:476 96>[Upgrade]
03:39:41:476 96>Determining max actions to execute in parallel (16 physical cores, 32 logical cores)
03:39:41:476 96> Executing up to 16 processes, one per physical core
03:39:41:476 96>Using Parallel executor to run 2 action(s)
03:39:41:476 96>------ Building 2 action(s) started ------
03:39:41:892 96>[1/2] Link [x64] CmdLink.exe
03:39:41:948 96>Module.Core.11.cpp.obj : error LNK2001: unresolved external symbol “wchar_t * GInternalProjectName” (?GInternalProjectName@@3PA_WA)
03:39:41:948 96>Module.Core.14.cpp.obj : error LNK2001: unresolved external symbol “wchar_t * GInternalProjectName” (?GInternalProjectName@@3PA_WA)
03:39:41:948 96>Module.Core.3.cpp.obj : error LNK2001: unresolved external symbol “wchar_t * GInternalProjectName” (?GInternalProjectName@@3PA_WA)
03:39:41:948 96>Module.Core.8.cpp.obj : error LNK2001: unresolved external symbol “wchar_t * GInternalProjectName” (?GInternalProjectName@@3PA_WA)
03:39:41:948 96>Module.Core.9.cpp.obj : error LNK2001: unresolved external symbol “wchar_t * GInternalProjectName” (?GInternalProjectName@@3PA_WA)
03:39:41:948 96>Module.Core.10.cpp.obj : error LNK2001: unresolved external symbol “wchar_t * GInternalProjectName” (?GInternalProjectName@@3PA_WA)
03:39:41:948 96>Module.Core.3.cpp.obj : error LNK2001: unresolved external symbol “wchar_t const * const GForeignEngineDir” (?GForeignEngineDir@@3PEB_WEB)
03:39:41:948 96>…\Binaries\Win64\CmdLink.exe : fatal error LNK1120: 2 unresolved externals
03:39:41:948 96>Total time in Parallel executor: 0.48 seconds
03:39:41:948 96>Total execution time: 81.76 seconds
03:39:41:983 96>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command “…..\Build\BatchFiles\Build.bat CmdLink Win64 Development -WaitMutex -FromMsBuild -architecture=x64” exited with code 6.
03:39:41:983 96>Done building project “CmdLink.vcxproj” – FAILED.

I’m not sure if this is correct, but I added the following code between the includes and enum EErrorMessage (~ln9) to CmdLink.cpp and the CMDLink project compiled. It’s similar to what they do in other Programs if you do a Find in files for GInternalProjectName.

#if !defined(UE_PROJECT_NAME)
TCHAR GInternalProjectName[64] = TEXT(“CmdLink”);
#else
TCHAR GInternalProjectName[64] = TEXT(PREPROCESSOR_TO_STRING(UE_PROJECT_NAME));
#endif
IMPLEMENT_FOREIGN_ENGINE_DIR()

1 Like

The fix from ue5-main upstream is to add

#include "RequiredProgramMainCPPInclude.h"

IMPLEMENT_APPLICATION(CmdLink, "CmdLink")

before the enum EErrorMessage declaration and to add "Projects" to the PrivateDependencyModuleNames.

It can already be done in 5.4.2 manually.

I’ve add this 2 line in CmdLink.cpp, and add “Projects” to PrivateDependencyModuleNames in Launch.Build.cs, but it still compiles ““Interfaces/IPluginManager.h”: No such file or directory CmdLink”, sorry did i make any mistake?

It should be in CmdLink.Build.cs not Launch.Build.cs ?

Tried this my build still failed and have some “other -new issues”

I’ve got the same error. Any solution?

Thanks man, you’re a hero! It solved my problem.

1 Like

Hey, did you figure out how to fix? Cause I’m getting exact same errors.

Hi! I already added the screenshot. Copy the code & paste it to CmdLink.cpp