0

I have project A and project B under one solution in Visual Studio. Project A needs to use some function of some class of project B, so in project B I have a file which contains all the header file of project B, let's call it AllHeadersOfB.h. This file is included in the stdafx.h file of project A, which is included in each class of project A.

I have a variable of type Y in the class X, where Y is a class of project B and X is a class of project A. In X, if I try to use some function of Y and this function is declared in the .h file and defined in the .cpp file I have an unresolved external link, but if the function is declared and defined in the header file this doesn't happen.

What am I doing wrong?

Astinog
  • 1,151
  • 3
  • 12
  • 35

1 Answers1

1

Including the headers is not enough. I guess project B is a library, so your project A needs to link to this library so that it can access the implementation of the class/function from B.

piwi
  • 5,136
  • 2
  • 24
  • 48