1

Using visual studio 2015 to compile a test code using catch.hpp unit test. I need to write code to interface with serial port and will need to interface with Widnows API and need to include windows.h

But compiler generates complains with error messages below.

Severity Code Description Project File Line Suppression State
Error C2888 'Catch::Colour::Colour(Catch::Colour::Code)': symbol cannot be defined within namespace 'Catch' NMCR_Testing c:\users\ahajmousa\google drive\cto projects\new mc receiver\software\testing\nmcr_testing\nmcr_testing\catch.hpp 7796
Error C2888 'Catch::Colour::Colour(const Catch::Colour &)': symbol cannot be defined within namespace 'Catch' NMCR_Testing c:\users\ahajmousa\google drive\cto projects\new mc .... ......

code:

#include "stdafx.h"
#include <windows.h>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

TEST_CASE("first Test")
{
    REQUIRE(1 == 1);
}

TEST_CASE("2nd  Test")
{
    REQUIRE(1 == 0);
}

Errors will go away if I do not include widnows.h Is there a way to get catch.hpp to compile without these errors.

Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
  • It is not very clear how this program could generate those error messages. But as posted it certainly can't compile, you must move the #include for window.h *after* the #include for catch.hpp. That takes care of the necessary NOMINMAX define. – Hans Passant Mar 14 '17 at 14:30
  • Thanks for response, moving the header definitions after catch.hpp fixed problem. – user7707901 Mar 16 '17 at 08:11

0 Answers0