0

I am working on a C++ application and I cannot build it because of LNK2001 and LNK2019 errors.

It has 4 projects: Client, Depry, Miscellaneous and Server. I want to have a base exception class in Miscellaneous and to be able to inherit from it in the Client and Server projects.

I tried adding the "include" folder from the Miscellaneous project to the Client's Additional Dependencies and I also added Miscellanous to Client's project dependencies. It did not work.

Example Errors:

Error   LNK2019 unresolved external symbol "public: virtual __cdecl DepryException::~DepryException(void)" (??1DepryException@@UEAA@XZ) referenced in function "public: virtual void * __cdecl DepryException::`scalar deleting destructor'(unsigned int)" (??_GDepryException@@UEAAPEAXI@Z)    ChatClient  E:\SEng\CPlusPlus\Depry\Client\ChatClient.obj   1   

Error   LNK2001 unresolved external symbol "public: virtual char const * __cdecl DepryException::what(void)const " (?what@DepryException@@UEBAPEBDXZ)   ChatClient  E:\SEng\CPlusPlus\Depry\Client\ChatClient.obj   1   
drobert
  • 1
  • 3
  • 1
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Richard Critten Jul 18 '17 at 14:04
  • I moved the method's bodies into the .hpp file and marked them with `inline` an it works this way, but I still do not know the real cause of the problem – drobert Jul 18 '17 at 14:40
  • Your project needs the method bodies (implementation). You either need to turn the other project into a library and include it in your link; or copy paste the source(s) into your project; or as you did turn them into inline functions. Just adding the include path and the headers does not add the implementation(s) to your project. – Richard Critten Jul 18 '17 at 15:20

0 Answers0