Including files from another project
I'm rather new to Visual Studio, and I have two projects in one solution, Foo and FooTest. In FooTest I've put my unit test classes (using QtTestLib), which will be testing the code in Foo.
Obviously, this means the unit tests in FooTest need to include header files from Foo. For FooTest, I've set Foo as a project dependency (context menu -> Project dependencies). I've also added Foo as a reference (context menu -> References).
However, I can't figure out how to actually include the header files from Foo in the FooTest unit test classes. I assume there is some prefix, like #include "Foo/SomeFooClass.h", but I haven't been able to figure out what it is and always end up with a "unresolved external symbol" during linking.
Can anyone give me a push in the right direction? Thanks in advance!
Re: Including files from another project
You just need to follow the path from one directory into the other.
Usually this would be
#include "../Foo/SomeFooClass.h"
If you're getting "unresolbved external symbol" error, it is not because of the #include.
This is a linker error which you get if you do not specify the .LIB file that belongs to the .DLL in the project dependencies.
Re: Including files from another project
Thanks for your reply, Superman. I suppose the problem is that I'm not building a DLL, but an EXE. The only reason I want to use code across the projects is that I'd like to test it.
Re: Including files from another project
How do you people generally organize your test and program code in Visual Studio?