Coding⏱️ 3 min read📅 2026-06-04

How to Fix: How can I solve the error LNK2019: unresolved external symbol - function?

LNK2019 error fix: Ensure proper function declarations and definitions, and check for missing library links.

Quick Answer: The error LNK2019 indicates that the linker is unable to find the definition of the function 'multiple' in your project. This is because the function declaration in 'function.h' and the function definition in 'function.cpp' are not properly linked.

The error LNK2019: unresolved external symbol - function occurs when the compiler is unable to find the definition of a function or variable that it needs. This error typically affects developers using Visual Studio 2013, particularly those working with C++ projects.

This error can be frustrating because it doesn't provide clear information about what's going wrong. However, by following this troubleshooting guide, you should be able to identify and fix the issue, allowing you to continue developing your project.

🛑 Root Causes of the Error

  • The primary reason for LNK2019: unresolved external symbol is that the function or variable is declared in one source file but not defined in another. This can happen when functions are declared in a header file (like `function.h`) but not defined in the corresponding source file (like `function.cpp`).
  • Another possible cause is a missing link between object files, which can occur if there's an issue with your project settings or compiler flags.

🚀 How to Resolve This Issue

Recompile and Link All Files

  1. Step 1: Step 1: Open the Solution Explorer in Visual Studio 2013 and ensure that all source files are included in the project. If necessary, add any missing files.
  2. Step 2: Step 2: In the Solution Explorer, right-click on the solution name `MyProjectTest` and select 'Build All' to recompile all files.
  3. Step 3: Step 3: After recompiling, go back to the 'Build' tab in the project properties window and ensure that the correct linker settings are selected. You may need to adjust the 'Additional Dependencies' field to include any necessary libraries or object files.

Check for Missing Function Definitions

  1. Step 1: Step 1: Review the source code of `function.cpp` to ensure that it matches the declaration in `function.h`. If there are discrepancies, correct them before proceeding.
  2. Step 2: Step 2: Check if any other source files are missing function definitions. If so, add or fix the necessary definitions.

💡 Conclusion

By following these steps and understanding the root causes of LNK2019: unresolved external symbol, you should be able to resolve this error in Visual Studio 2013 and continue developing your project.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions