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?