LNK1189 error when compiling Developer Editor

Using Unreal Engine 4.27.2, same error in both VS2019 and VS2022.
Same error is I use the Source Build or 4.27 for the project.

I’ve gotten pretty far with my current project and it getting really large and it seem that I’ve hit a hard target and when I hit “Local Windows Debugger” I get the error below.

I think normally I would add the /BigObj flag to the linker by going into the project properties in visual studio and under C++ change Additional Options but that seem to be unavailable for me in this project. I tried editing my “AA29.vcxproj” directly but I suspect that UBT is blocking the setting.

Build started…
1>------ Build started: Project: AA29, Configuration: Development_Editor x64 ------
1>Using ‘git status’ to determine working set for adaptive non-unity build (D:\UDK4\UnrealEngine).
1>Creating makefile for AA29Editor (UnrealBuildTool.exe is newer)
1>Creating makefile for ShaderCompileWorker (UnrealBuildTool.exe is newer)
1>Building AA29Editor and ShaderCompileWorker…
1>Using Visual Studio 2019 14.29.30137 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 2 actions with 32 processes…
1> [1/2] UE4Editor-AA29.lib
1>LINK : fatal error LNK1189: library limit of 65535 objects exceeded
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command “D:\UDK4\UnrealEngine\Engine\Build\BatchFiles\Build.bat -Target=“AA29Editor Win64 Development -Project="D:\UDK4\Unreal Projects\AA29\AA29.uproject"” -Target=“ShaderCompileWorker Win64 Development -Quiet” -WaitMutex -FromMsBuild” exited with code 6.
1>Done building project “AA29.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

Anyone with ideas?

This is specific when running Debug on Developer Editor.
.EDIT I also get it when using Debug/Start Without Debugging.

The problem is the number of exports, I can Enable/Remove the last function I did and get it to compile.

wait, wait, what is causing the issue? if you enable/remove what specifically, you get it to compile?

If I remove the last function I added it will start working(Compile, and editor starting) again
If I add a new function anywhere else in the project it will stop working, since the number of exports has gone over 65535 again.

It is a really large project at this time 450K+ rows, 3000+ classes.
It is a convert of an old game done in Unreal Engine 2.5(UnrealScript).

As shown in the output above it is this Configuration that I’ve having trouble with: Development_Editor

The last function?

Are you declaring all of your classes with the _API macro??

1 Like

Yes, I assume that that is the reason they are all exports?
I was hoping to find a workaround so that I would be able to import all classes from the game and then then start tinkering with the code.

I’ll test doing a class without the macro and verify that it helps.

I can confirm that removing the *_API on a class that had 5 functions allowed me to add 5 more functions somewhere else. Guess I will have to read up on *_API then. It was nothing I added manually, it was added automatically when I added the classes.

But still I would like to get info about if there is a switch like “/BigObj” or something else that would allow me to complete this phase of the project as planned.

I’m very curious about the structure involved here, this sounds really out there. :smiley:

ModuleName_API macro is used to allow your code to be linked to by other packages. Classes without the ModuleName_API macro are only usable in that package. Honestly, I was just guessing since that’s the only thing that I know of that affects ability to link other packages. (and the Build.cs for the package, of course)

I have no idea on the Linker question, I don’t know anything about the Microsoft linker.

The biggest project I’ve ever worked on had probably 1200 source files across 4 different modules, and most of them were not _API declared. I don’t know if you could get around that limit by splitting it into separate Modules, perhaps.

You’ve definitely got me curious as to what you’ve got there.

The only reason they were declared as _API was that I created the classes though the Editor, and seem to be the default. Before this Project I’ve tried to steer clear of C++, so it’s been quite the steep learning curve so there is a lots of “defaults”, like the _API config in the code.

The main goal of this phase was to get all the source code extracted from the old game and added to the same class thee as they was in UnrealScript.
The old game in question is America’s Army 2.8.5, Based on UnrealEngine 2.5.

I’ve adapted the decompiler a bit to simplify insertion to C++ Classes, so for instance in the pic below you see “int32”(C++) instead of “integer”(UnrealScript), but most is still vanilla UnrealScript.

Frankly, you’d be better off just using the old code as a reference to see how it worked, and then re-implement all of it, probably differently. Very little is same between UE2 and UE4. A few shortcuts in the editor, and that’s about all I can think of :slight_smile:

But, anyway, if that’s going to be your main game module, you probably don’t need the _API macro in any of it.