Unresolved external symbol in object files

This error often means that some function has a declaration, but not a definition.


// A.hpp
class A
  void myFunc(); // Function declaration

// A.cpp

// Function definition
void A::myFunc()
  // do stuff

In your case, the definition cannot be found. The issue could be that you are including a header file, which brings in some function declarations, but you either:

  1. do not define the functions in your cpp file (if you wrote this code yourself)
  2. do not include the lib/dll file that contains the definitions

A common mistake is that you define a function as a standalone and forget the class selector, e.g. A::, in your .cpp file:

Wrong: void myFunc() { /* do stuff */ }
Right: void A::myFunc() { /* do stuff */ }

Leave a Comment