Error LNK2011: precompiled object not linked in; image may not run

We’ve recently upgraded our project to use 4.12.5 but have been receiving a linker error when compiling the Debug Editor configuration.

The issue can be reproduced with the UE source from Github and the PlatformerGame content sample. Using the right click → Build menu on each project:

  • Build PlatformerGame
  • Build UE4
  • Build PlatformerGame

The second build of PlatformerGame will cause the error “Module.Renderer.9_of_9.cpp.obj : error LNK2011: precompiled object not linked in; image may not run”. The module that is listed is not always consistent and sometimes occurs for a dozen different modules. At this point cleaning PlatformerGame is the only way to get it to successfully build. The same linker error will occur when building in the order UE4, PlatformerGame and then UE4.

Setup used:

VS2015 Community (no updates)

UE 4.12.5 from Github

PlatformerGame

Hello Keagan_sdw,

I had to grab the Github build of 4.12.5 so I’m in the middle of compiling the source for that right now to try reproducing this but about to go home for the day. I wanted to ask something just to clear it up before I hop on this tomorrow.

Do you happen to be placing PlatformerGame in the same folder as your Github 4.12.5 installation? It’s not a problem if so or not, I just want to know for reproduction purposes.

Hi Matthew,

I’ve been placing the PlatformerGame within the Samples directory such that it follows this structure: .\Samples\Games\PlatformerGame\PlatformerGame.uproject.

-K

Thank you for those details. I tried reproducing this in the way that you mentioned but I’m not seeing the same error. Just to be thorough on the exact steps that I’m using…

  1. Downloaded the 4.12.5 Github build, ran Setup.bat, ran GenerateProjectFiles.bat and then built the engine for Development Editor
  2. In the Epic Games Launcher, downloaded Platformer Game and created a project based off it for 4.12.5 Binary
  3. Launched 4.12.5 Github so that it would show up in the list of available builds when converting a project
  4. Converted the Platformer Game Project to 4.12.5 Github
  5. Moved the Platformer Game Project to the Engine/Samples/Games/ folder under the 4.12.5 Github folder.
  6. Opened the Platformer Game .sln and compiled Platformer Game for Development Editor
  7. With the same .sln open, right-clicked UE4 and built it for Development Editor again (I hit Build, not Rebuild)
  8. With the same .sln open, right-clicked on PlatformerGame and built it for Development Editor again.

At this point, the build succeeded for me and I didn’t receive the error you mentioned. Is there anything that I did differently?

Hi Matthew,

Thanks for testing this. Those steps are the same process that I am going through except 3/4. However, on steps 6-8 I have been using the Debug Editor configuration which is where I receive the linker error. Development seems to build successfully each time but we frequently use the Debug Editor configuration on our project.

-K

Ah I overlooked that in the original post. Glad I clarified everything then. I’ll get on testing that shortly.

Unfortunately I’m still not seeing the error. When you mention that you don’t do step 3/4, how are you converting the project over from whatever version it was bound to in Binary to your 4.12.5 source build? Also, do you rebuild in Step 7 or 8? From my attempts, attempting to build the project for Debug Editor a second time (after doing it in Step 6) immediately succeeds as there are no updates to compile.

I have not be performing the convert step at all. Is it from using the right click context menu on PlatformerGame.uproject and choosing Switch Unreal Engine version…?

The steps I have been following:

  1. From the Launcher’s PlatformerGame entry, choose Create Project.

  2. Choose the 4.12 version.

  3. Move PlatformerGame into the Samples/Games folder.

  4. Run GenerateProjectFiles.bat.

  5. Open UE4.sln and select Debug Editor x64.

  6. Right click PlatformerGame and select Build.

  7. Right click UE4 and select Build.

  8. Right click PlatformerGame and select Build.

I would expect the PlatformerGame to already be up to date as you described but with my test it would end up compiling some modules. Do you think this is due to missing the convert step for the project?

Similar question [Bug report, UE 4.13] Error LNK2011: precompiled object not linked in; image may not run - Feedback & Requests - Epic Developer Community Forums .

It’s very hard to reproduce that bug…

That is what I’m using. If you’re not using the conversion step, then that project should still be pointing toward your 4.12 Binary installation. One easy way to tell is to see if you see all of the extra modules included in a source build such as these when you open your Platformer Game .sln. If they’re not listed there, then you’re not currently building for the 4.12.5 Github build.

The extra Programs as well as UE4 and PlatformerGame are visible in the solution. However, I’m using the UE4.sln in the root directory that is produced by GenerateProjectFiles.bat. I also have not installed the Engine from the Launcher. I was only using the Launcher as a way to get the sample projects and move them into the directory created from the Github .

So after downloading the Platformer Game from the launcher, where did you copy it from to move it to your Github 4.12.5 source build? I was using the “Install To Engine” option, creating the project in 4.12, and then copying it over.

When you mention that you’re using the UE4.sln in the root directory, you mean that you’re able to see the PlatformerGame module from that .sln? This doesn’t seem right with the file path given. To clear things up, I’m placing my project in D:\4.12.5 Github\Samples\Games\PlatformerGame. Does that sound right?

That path looks similar to mine. I am able to see the PlatformerGame project using the UE4.sln. This is how I’ve been adding it to my Github source:

  1. From the Launcher, select Create Project on PlatformerGame.

  2. Browse to F:\UE4 Samples, select 4.12 as the version and hit Create.

  3. Navigate to F:\UE4 Samples, move the PlatformerGame folder to E:\4.12.5\Samples\Games\ making the project’s full path as E:\4.12.5\Samples\Games\PlatformerGame\PlatformerGame.uproject.

  4. Run E:\4.12.5\GenerateProjectFiles.bat.

  5. Open E:\4.12.5\UE4.sln (it looks like the image you posted previously where PlatformerGame is included).

  6. Perform right-click Build on PlatformerGame, UE4, PlatformerGame.

Ah hah, I was able to reproduce it. The problem before is that I was switching to Development Editor for compiling UE4, as said in the steps I mentioned before. If I keep it on Debug Editor across all 3 compiles, the issue occurs. I’m going to give it a test on our latest internal build to ensure it still happens and then I’ll be putting in a bug report if so. Thank you for working with me on this.

Hi Matthew,

I’m currently retracing my steps to verify everything and found that I edited the UE4Games.uprojectdirs file by adding the line Samples/Games to it. This causes PlatformerGame to be visible inside the UE4.sln after GenerateProjectFiles.bat.

However, I have reverted that change and instead placed PlatformerGame at the same level as the Engine folder (F:\4.12.5\Engine & F:\4.12.5\PlatformerGame). This configuration mimic’s our project’s setup which is also having the linker error. When PlatformerGame is next to Engine it will be visible within the UE4.sln after running GenerateProjectFiles.bat.

Following the procedure of:

  1. Open F:\4.12.5\UE4.sln.

  2. Select Development Editor.

  3. Right click, Build UE4.

  4. Right click, Build PlatformerGame.

  5. Switch to Debug Editor.

  6. Right click, Build PlatformerGame.

  7. Right click, Build UE4.

  8. Right click, Build PlatformerGame.

This results in the same linker error as before. I’ve received the linker error in both VS2015 Community (no updates) and VS2015 Enterprise Update 3. Is there some mistake that I am making or something I am missing?

Missed your reply before I posted.

I’m glad you were able to reproduce it! I look forward to hearing the results of the test on the internal build. Thanks again for testing it.

Well good news and bad news. I’m not having any luck reproducing it in our latest version, although our latest version is currently what will become 4.14. That means that this fix may not be in for 4.13, although I would suggest giving the latest 4.13 version from Github a try when you can to see.

Just to add, I did have to comment out a few lines to let PlatformerGame compile in the latest version but they don’t seem like they would be part of the error.

I’ve tested this with the 4.13.0-preview-2 build on Github and the linker error doesn’t appear to be happening (after commenting out some code as you mentioned).

Would you happen to know which modules I could look through to see if I can find out what fixed it?
Or what the time frame is for 4.13 to be released officially?

I’d honestly have no idea where to begin looking. It would likely be UBT related but I’m not sure. As far as the time frame, I can’t give any exact dates but I can say it should be soon. I’m sorry I can’t say more.

this happened a lot on my side too. bcz of the nature of my job I had to modify engine a lot. during coding I use debug editor mode and for performance test I use development mode. whenever I switch from debug to development it happens always. I think somewhere ue4 build tool use a common obj file for both debug and development both . which actually does not content updated c++ code. so it gives me that error.

so I had to stop switching mode. and for now developing only in debug mode.
I am using 4.11.2

and I am having this errors since 4.9.x