Search code examples
c++visual-studiounit-testingcatch-unit-test

Using Catch2 in Visual C++ 2015


I'm trying to make a Unit Testing project using the Catch framework, but am faced with Link errors.

I've set up the project as follows:

  1. Create a Native Unit Test project
  2. Add Catch to the include directories
  3. Add #include <catch.hpp> to stdafx.h
  4. Write the following simple source file

unittest.cpp:

#include "stdafx.h"
namespace Catch2_Test
{
  TEST_CASE("Y U no work")
  {
    REQUIRE(1);
  }
}

Solution

  • The problem was that I had cloned Catch2 from the master branch, while the VS integration worked on a branch off Catch.