Search code examples
c++unit-testingvisual-studio-2017vs-unit-testing-framework

Visual Studio 2017 native unit testing - reference to project doesn't work


I'm using the Visual Studio 2017 native unit testing framework to test a C++ exe project Foo with a test project FooTest. I followed this tutorial to set this up.

I added a reference to Foo to FooTest. I can include Foo's files in FooTest with #include "..\Foo\Foo.h". However, it doesn't seem to automatically link with Foo's compiler output, so I get lots of "unresolved external symbol" linker errors for things which are declared in Foo.h but defined in Foo.cpp.

Do I manually have to add folders to the project's library folders and link to the compiled output of Foo? Neither the tutorial nor the docs indicate anything like that.


Solution

  • You've read the docs, but maybe this reference was not one of them?

    https://msdn.microsoft.com/en-us/library/hh419385.aspx

    It's a VS2015 doc. Would the "Deciding how to test your code" section provide any clues?