-
July 24th, 2009, 02:27 AM
#1
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!
-
July 24th, 2009, 04:32 AM
#2
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.
-
July 24th, 2009, 05:05 AM
#3
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.
-
July 25th, 2009, 02:35 PM
#4
Re: Including files from another project
How do you people generally organize your test and program code in Visual Studio?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|