Linker Errors LNK2001 & LNK2019 when packaging the project


I have just finished the development of my game and want to package it for the windows (64-bit). However, when I try to run the packaging process, it fails with linker errors unresolved symbols. But, the weird thing is that the game is compiling and running fine in the editor.

I have included the packaging logs below. Has anyone experienced this before? Any help will be appreciated.

link text

I think this means, that you have a function in your header file that doesn’t exist in your cpp file.

But, I’m able to build the project in Editor. If the function definition was missing, it would have raised the same error then and there…

Then show me your code for the functions the error is occuring. .h and .cpp :slight_smile:

Thank you for your time and effort, but I’ve figured out what was I doing wrong.

So, what was happening was that the methods for which I was getting the linker errors, were declared as ‘inline’ but due to some reason I defined them in the .cpp file. Because of that the linker was not able to find the function definitions for those function while packaging.

This brings another doubt. Why didn’t the linker raise that error when compiling in the editor? Does this mean that the linker’s functioning is somehow different for both the operations?? Or is it a Bug?

1 Like

I had the same error caused by inconsitently placed #if WITH_EDITOR and #endif between header and source files. Maybe it will help somebody :slight_smile:

Hello, I’m having same problem on my project. Editor works fine but Everytime I try to package my project, LNK2019 & LNK2001 errors come out.
Can you describe your solution with more details?
Did you moved your function body to .h file?

I had same problem and here is my solution. (the way I fixed my errors)
I had same LNK2001 & LNK 2019 errors and I found this video()
I tried to rebuild, clean the whole solution but it didn’t work.

but REMOVE INTERMEDIATE FOLDER (specifically, i just removed Intermediate>Build>Win64>{My Proejct Name} Folder) fixed my errors.

So, If you are having similar/same issues, try removing that folder.

Yes, you are correct. I moved the function body to .h file
Since they were inline functions, the linker was expecting them to be defined in the .h file itself…

I finally fixed the same error thanks to you.