catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.72k stars 3.06k forks source link

CATCH Not compiling! #1034

Closed PRGWITHSTYLE closed 7 years ago

PRGWITHSTYLE commented 7 years ago

Description:

I'm currently attempting to use Catch in an MFC application but cannot build for some reason.

include "stdafx.h"

include "Test1.h"

define CATCH_CONFIG_RUNNER

include "catch.hpp"

Error C2061: syntax error: identifier 'storage' (3101)

I've added #define NOMINMAX to my stdafx.h file to prevent a slew of errors already associated with MFC builds mentioned here https://github.com/philsquared/Catch/issues/910.

My stdafx.h contains:

include "targetver.h"

include

include

define NOMINMAX

Extra information

Using Catch v.1.10.0

martinmoene commented 7 years ago

What's the result if you start stdafx.h with NOMINMAX, or compile with -DNOMINMAX for that matter?

// stdafx.h

#define NOMINMAX

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>
PRGWITHSTYLE commented 7 years ago

If I start with #define NOMINMAX as suggested the same result as the initial post.

horenmar commented 7 years ago

Something is interfering with placement new in your build.

Cursory googling suggests that MS used to do a very stupid thing, where they defined new to DBG_NEW, which breaks placement new.

PRGWITHSTYLE commented 7 years ago

If i remove the #define NOMINMAX from my stdafx.h these errors appear on build.

Error list:

Error C2059: syntax error: ')' (7223) Error C2334: unexpected token(s) preceding ':'; skipping apparent function body (7223) Error C2143: syntax error: missing ')' before ';' (7236) Error C2059: syntax error: ')' (7236) Error C2238: unexpected token(s) preceding ';' (7236) Error C2672: 'shuffle': no matching overloaded function found (7249) Error C2039: 'shuffle': is not a member of 'Catch::RandomNumberGenerator' (7249) Error C2780: 'void std::shuffle(_RanIt,_RanIt,_Urng &&)': expects 3 arguments - 1 provided (7249) Error C2352: 'Catch::RandomNumberGenerator::enforceNoDuplicateTestCases': illegal call of non-static member function (7318) Error C2352: 'Catch::RandomNumberGenerator::sortTests': illegal call of non-static member function (7321) Error C2838: '{ctor}': illegal qualified name in member declaration (7391) Error C3254: 'Catch::RandomNumberGenerator': class contains explicit override '{ctor}' but does not derive from an interface that contains the function declaration (7391) Error C2838: '{dtor}': illegal qualified name in member declaration (7395) Error C3254: 'Catch::RandomNumberGenerator': class contains explicit override '{dtor}' but does not derive from an interface that contains the function declaration (7395) Error C2143: syntax error: missing ';' before 'namespace' (7404) Error C2065: 'm_testCaseRegistry': undeclared identifier (7537) Error C2228: left of '.registerTest' must have class/struct/union (7554) Error C2065: 'm_testCaseRegistry': undeclared identifier (7554) Error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (7564) Error C3646: 'm_testCaseRegistry': unknown override specifier (7564) Error C2888: 'Catch::NotImplementedException::NotImplementedException(const Catch::SourceLineInfo &)': symbol cannot be defined within namespace 'Catch' (7604) Error C2888: 'const char Catch::NotImplementedException::what(void) noexcept const': symbol cannot be defined within namespace 'Catch' (7611) Error C2888: 'Catch::FileStream::FileStream(const std::string &)': symbol cannot be defined within namespace 'Catch' (7667) Error C2888: 'std::ostream &Catch::FileStream::stream(void) const': symbol cannot be defined within namespace 'Catch' (7676) Error C2888: 'Catch::DebugOutStream::DebugOutStream(void)': symbol cannot be defined within namespace 'Catch' (7688) Error C2888: 'std::ostream &Catch::DebugOutStream::stream(void) const': symbol cannot be defined within namespace 'Catch' (7692) Error C2888: 'Catch::CoutStream::CoutStream(void)': symbol cannot be defined within namespace 'Catch' (7699) Error C2039: 'cout': is not a member of 'Catch::Catch' (7699) Error C2888: 'std::ostream &Catch::CoutStream::stream(void) const': symbol cannot be defined within namespace 'Catch' (7702) Error C2888: 'Catch::Colour::Colour(Catch::Colour::Code)': symbol cannot be defined within namespace 'Catch' (7996) Error C2888: 'Catch::Colour::Colour(const Catch::Colour &)': symbol cannot be defined within namespace 'Catch' (7997) Error C2888: 'Catch::Colour::~Colour(void)': symbol cannot be defined within namespace 'Catch' (7998) Error C2888: 'void Catch::Colour::use(Catch::Colour::Code)': symbol cannot be defined within namespace 'Catch' (8000) Error C2888: 'Catch::AssertionInfo::AssertionInfo(void)': symbol cannot be defined within namespace 'Catch' (8086) Error C2888: 'Catch::AssertionInfo::AssertionInfo(const char ,const Catch::SourceLineInfo &,const char ,Catch::ResultDisposition::Flags,const char )': symbol cannot be defined within namespace 'Catch' (8093) Error C2888: 'Catch::AssertionResult::AssertionResult(void)': symbol cannot be defined within namespace 'Catch' (8100) Error C2264: 'Catch::AssertionInfo::AssertionInfo': error in function definition or declaration; function not called (8100) Error C2888: 'Catch::AssertionResult::AssertionResult(const Catch::AssertionInfo &,const Catch::AssertionResultData &)': symbol cannot be defined within namespace 'Catch' (8103) Error C2888: 'Catch::AssertionResult::~AssertionResult(void)': symbol cannot be defined within namespace 'Catch' (8107) Error C2888: 'bool Catch::AssertionResult::succeeded(void) const': symbol cannot be defined within namespace 'Catch' (8110) Error C2039: 'isOk': is not a member of 'Catch::Catch' (8111) Error C2660: 'Catch::AssertionResult::isOk': function does not take 1 arguments (8111) Error C2888: 'bool Catch::AssertionResult::isOk(void) const': symbol cannot be defined within namespace 'Catch' (8115) Error C2039: 'isOk': is not a member of 'Catch::Catch' (8116) Error C2888: 'Catch::ResultWas::OfType Catch::AssertionResult::getResultType(void) const': symbol cannot be defined within namespace 'Catch' (8119) Error C2888: 'bool Catch::AssertionResult::hasExpression(void) const': symbol cannot be defined within namespace 'Catch' (8123) Error C2888: 'bool Catch::AssertionResult::hasMessage(void) const': symbol cannot be defined within namespace 'Catch' (8127) Error C2888: 'std::string Catch::AssertionResult::getExpression(void) const': symbol cannot be defined within namespace 'Catch' (8137) Error C2888: 'std::string Catch::AssertionResult::getExpressionInMacro(void) const': symbol cannot be defined within namespace 'Catch' (8143) Error C2888: 'bool Catch::AssertionResult::hasExpandedExpression(void) const': symbol cannot be defined within namespace 'Catch' (8150) Error C2888: 'std::string Catch::AssertionResult::getExpandedExpression(void) const': symbol cannot be defined within namespace 'Catch' (8154) Error C2888: 'std::string Catch::AssertionResult::getMessage(void) const': symbol cannot be defined within namespace 'Catch' (8158) Error C2888: 'Catch::SourceLineInfo Catch::AssertionResult::getSourceInfo(void) const': symbol cannot be defined within namespace 'Catch' (8161) Error C2888: 'std::string Catch::AssertionResult::getTestMacroName(void) const': symbol cannot be defined within namespace 'Catch' (8165) Error C2888: 'void Catch::AssertionResult::discardDecomposedExpression(void) const': symbol cannot be defined within namespace 'Catch' (8169) Error C2888: 'void Catch::AssertionResult::expandDecomposedExpression(void) const': symbol cannot be defined within namespace 'Catch' (8173) Error C2264: 'Catch::Colour::Colour': error in function definition or declaration; function not called (8208) Error C2264: 'Catch::Colour::Colour': error in function definition or declaration; function not called (8211) Error C2888: 'Catch::TestCaseInfo::TestCaseInfo(const std::string &,const std::string &,const std::string &,const std::set<std::string,std::less<_Kty>,std::allocator<_Kty>> &,const Catch::SourceLineInfo &)': symbol cannot be defined within namespace 'Catch' (8282) Error C2668: 'Catch::Catch::setTags': ambiguous call to overloaded function (8288) Error C2888: 'Catch::TestCaseInfo::TestCaseInfo(const Catch::TestCaseInfo &)': symbol cannot be defined within namespace 'Catch' (8292) Error C2888: 'bool Catch::TestCaseInfo::isHidden(void) const': symbol cannot be defined within namespace 'Catch' (8302) Error C2888: 'bool Catch::TestCaseInfo::throws(void) const': symbol cannot be defined within namespace 'Catch' (8305) Error C2888: 'bool Catch::TestCaseInfo::okToFail(void) const': symbol cannot be defined within namespace 'Catch' (8308) Error C2888: 'bool Catch::TestCaseInfo::expectedToFail(void) const': symbol cannot be defined within namespace 'Catch' (8311) Error C2888: 'Catch::TestCase::TestCase(Catch::ITestCase ,const Catch::TestCaseInfo &)': symbol cannot be defined within namespace 'Catch' (8315) Error C2264: 'Catch::TestCaseInfo::TestCaseInfo': error in function definition or declaration; function not called (8315) Error C2888: 'Catch::TestCase::TestCase(const Catch::TestCase &)': symbol cannot be defined within namespace 'Catch' (8318) Error C2264: 'Catch::TestCaseInfo::TestCaseInfo': error in function definition or declaration; function not called (8320) Error C2888: 'Catch::TestCase Catch::TestCase::withName(const std::string &) const': symbol cannot be defined within namespace 'Catch' (8322) Error C2264: 'Catch::TestCase::TestCase': error in function definition or declaration; function not called (8323) Error C2888: 'void Catch::TestCase::swap(Catch::TestCase &)': symbol cannot be defined within namespace 'Catch' (8328) Error C2888: 'void Catch::TestCase::invoke(void) const': symbol cannot be defined within namespace 'Catch' (8340) Error C2888: 'bool Catch::TestCase::operator ==(const Catch::TestCase &) const': symbol cannot be defined within namespace 'Catch' (8344) Error C2888: 'bool Catch::TestCase::operator <(const Catch::TestCase &) const': symbol cannot be defined within namespace 'Catch' (8350) Error C2888: 'Catch::TestCase &Catch::TestCase::operator =(const Catch::TestCase &)': symbol cannot be defined within namespace 'Catch' (8353) Error C2264: 'Catch::TestCase::TestCase': error in function definition or declaration; function not called (8354) Error C2888: 'const Catch::TestCaseInfo &Catch::TestCase::getTestCaseInfo(void) const': symbol cannot be defined within namespace 'Catch' (8360) Error C2888: 'Catch::Version::Version(unsigned int,unsigned int,unsigned int,const char const ,unsigned int)': symbol cannot be defined within namespace 'Catch' (8377) Error C2264: 'Catch::Version::Version': error in function definition or declaration; function not called (8397) Error C2888: 'Catch::MessageInfo::MessageInfo(const std::string &,const Catch::SourceLineInfo &,Catch::ResultWas::OfType)': symbol cannot be defined within namespace 'Catch' (8411) Error C2888: 'unsigned int Catch::MessageInfo::globalCount': symbol cannot be defined within namespace 'Catch' (8418) Error C2888: 'Catch::ScopedMessage::ScopedMessage(const Catch::MessageBuilder &)': symbol cannot be defined within namespace 'Catch' (8423) Error C2888: 'Catch::ScopedMessage::ScopedMessage(const Catch::ScopedMessage &)': symbol cannot be defined within namespace 'Catch' (8429) Error C2888: 'Catch::ScopedMessage::~ScopedMessage(void)': symbol cannot be defined within namespace 'Catch' (8432) Error C2888: 'void Catch::Timer::start(void)': symbol cannot be defined within namespace 'Catch' (8602) Error C2888: 'unsigned int Catch::Timer::getElapsedMicroseconds(void) const': symbol cannot be defined within namespace 'Catch' (8605) Error C2888: 'unsigned int Catch::Timer::getElapsedMilliseconds(void) const': symbol cannot be defined within namespace 'Catch' (8608) Error C2888: 'double Catch::Timer::getElapsedSeconds(void) const': symbol cannot be defined within namespace 'Catch' (8611) Error C2888: 'Catch::pluralise::pluralise(std::size_t,const std::string &)': symbol cannot be defined within namespace 'Catch' (8677) Error C2888: 'Catch::SourceLineInfo::SourceLineInfo(void)': symbol cannot be defined within namespace 'Catch' (8688) Error C2888: 'Catch::SourceLineInfo::SourceLineInfo(const char ,std::size_t)': symbol cannot be defined within namespace 'Catch' (8690) Error C2888: 'bool Catch::SourceLineInfo::empty(void) const': symbol cannot be defined within namespace 'Catch' (8693) Error C2888: 'bool Catch::SourceLineInfo::operator ==(const Catch::SourceLineInfo &) const': symbol cannot be defined within namespace 'Catch' (8696) Error C2888: 'bool Catch::SourceLineInfo::operator <(const Catch::SourceLineInfo &) const': symbol cannot be defined within namespace 'Catch' (8699) Error C2593: 'operator <<' is ambiguous (8722) Error C2888: 'Catch::SectionInfo::SectionInfo(const Catch::SourceLineInfo &,const std::string &,const std::string &)': symbol cannot be defined within namespace 'Catch' (8737) Error C2888: 'Catch::Section::Section(const Catch::SectionInfo &)': symbol cannot be defined within namespace 'Catch' (8743) Error C2888: 'Catch::Section::~Section(void)': symbol cannot be defined within namespace 'Catch' (8753) Error C2661: 'Catch::SectionEndInfo::SectionEndInfo': no overloaded function takes 2 arguments (8755) Error C2888: 'Catch::Section::operator bool(void) const': symbol cannot be defined within namespace 'Catch' (8767) Error C2888: 'Catch::ResultBuilder::ResultBuilder(const char ,const Catch::SourceLineInfo &,const char ,Catch::ResultDisposition::Flags,const char )': symbol cannot be defined within namespace 'Catch' (9102) Error C1003: error count exceeds 100; stopping compilation (9102)

philsquared commented 7 years ago

@PRGWITHSTYLE there was an issue with the generated single include for MSVC in dev build 4. This has been fixed and, just today, I've released a new single include (v2.0.0-develop.5) with the fix. That should address your last issues. As for the NOMINMAX, that shouldn't be necessary, tbh, as we've been wrapping all our mins and maxs in parentheses to prevent the macro conflict. I did spot one case that had crept in and have fixed that now (also in the develop.5 release) - so would appreciate if you could confirm whether or not it works for you without NOMINMAX too?

Thanks - and sorry for the delay - I've been travelling a lot recently.

PRGWITHSTYLE commented 7 years ago

Well it seems that now catch will not build at all with these errors and the teamCity reporter is broken on the latest 2.00 build:

Error C2955: 'Catch::StreamingReporterBase': use of class template requires template argument list (1)
Error C2352: 'Catch::StreamingReporterBase<DerivedT>::testCaseStarting': illegal call of non-static member function (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2955: 'Catch::StreamingReporterBase': use of class template requires template argument list (1)
Error C2352: 'Catch::StreamingReporterBase<DerivedT>::testCaseEnded': illegal call of non-static member function (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2065: 'm_sectionStack': undeclared identifier (1)
Error C2228: left of '.empty' must have class/struct/union (1)
Error C2065: 'm_sectionStack': undeclared identifier (1)
Error C2228: left of '.size' must have class/struct/union (1)
Error C2065: 'm_sectionStack': undeclared identifier (1)
Error C2955: 'Catch::StreamingReporterBase': use of class template requires template argument list (1)
Error C2065: 'm_sectionStack': undeclared identifier (1)
Error C2065: 'm_sectionStack': undeclared identifier (1)
Error C2228: left of '.front' must have class/struct/union (1)
Error C2228: left of '.lineInfo' must have class/struct/union (1)
Error C3861: 'TextAttributes': identifier not found (1)
Error C2228: left of '.setIndent' must have class/struct/union (1)
Error C2228: left of '.setInitialIndent' must have class/struct/union (1)
Error C3861: 'Text': identifier not found (1)
Error C2275: 'Catch::TeamCityReporter': illegal use of this type as an expression (1)
Error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (1)
Error C2440: 'initializing': cannot convert from 'initializer list' to 'int' (1)
Error C2059: syntax error: '}' (1)
Error C2143: syntax error: missing ';' before '}' (1)
Error C2228: left of '.end' must have class/struct/union (1)
Error C2352: 'Catch::StreamingReporterBase<DerivedT>::sectionStarting': illegal call of non-static member function (1)
Error C2228: left of '.begin' must have class/struct/union (1)
Error C2227: left of '->name' must point to class/struct/union/generic type (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C3646: 'CATCH_OVERRIDE': unknown override specifier (1)
Error C2614: 'Catch::TeamCityReporter': illegal member initialization: 'StreamingReporterBase' is not a base or member (1)
Error C2065: 'm_reporterPrefs': undeclared identifier (1)
Error C2228: left of '.shouldRedirectStdOut' must have class/struct/union (1)
Error C2955: 'Catch::StreamingReporterBase': use of class template requires template argument list (1)
Error C2955: 'Catch::StreamingReporterBase': use of class template requires template argument list (1)
Error C2352: 'Catch::StreamingReporterBase<DerivedT>::testGroupStarting': illegal call of non-static member function (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2955: 'Catch::StreamingReporterBase': use of class template requires template argument list (1)
Error C2352: 'Catch::StreamingReporterBase<DerivedT>::testGroupEnded': illegal call of non-static member function (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2065: 'CATCH_NOT_IMPLEMENTED': undeclared identifier (1)
Error C2065: 'currentTestCaseInfo': undeclared identifier (1)
Error C2227: left of '->okToFail' must point to class/struct/union/generic type (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2065: 'currentTestCaseInfo': undeclared identifier (1)
Error C2227: left of '->name' must point to class/struct/union/generic type (1)
Error C2065: 'stream': undeclared identifier (1)
Error C2065: 'currentTestCaseInfo': undeclared identifier (1)
Error C3861: '__catchResult': identifier not found (1151)
Error C2146: syntax error: missing ';' before identifier '__catchResult' (1151)
Error C2039: 'ResultBuilder': is not a member of 'Catch' (1151)
Error C2065: 'ResultBuilder': undeclared identifier (1151)
Error C2065: '__catchResult': undeclared identifier (1153)
Error C2065: '__catchResult': undeclared identifier (1154)
Error C2228: left of '.captureResult' must have class/struct/union (1154)
Error C2065: '__catchResult': undeclared identifier (1155)
Error C2228: left of '.shouldDebugBreak' must have class/struct/union (1155)
Error C2228: left of '.reactWithoutDebugBreak' must have class/struct/union (1155)
Error C2039: 'ResultBuilder': is not a member of 'Catch' (1161)
Error C2065: 'ResultBuilder': undeclared identifier (1161)
Error C2146: syntax error: missing ';' before identifier '__catchResult' (1161)
Error C3861: '__catchResult': identifier not found (1161)
Error C2065: '__catchResult': undeclared identifier (1164)
Error C2228: left of '.captureResult' must have class/struct/union (1165)
Error C2065: '__catchResult': undeclared identifier (1165)
Error C2065: '__catchResult': undeclared identifier (1166)
Error C2228: left of '.shouldDebugBreak' must have class/struct/union (1166)
Error C2228: left of '.reactWithoutDebugBreak' must have class/struct/union (1166)
Error C2039: 'ResultBuilder': is not a member of 'Catch' (1172)
Error C2065: 'ResultBuilder': undeclared identifier (1172)
Error C2146: syntax error: missing ';' before identifier '__catchResult' (1172)
Error C3861: '__catchResult': identifier not found (1172)
Error C2065: '__catchResult': undeclared identifier (1175)
Error C2065: '__catchResult': undeclared identifier (1176)
Error C2228: left of '.captureResult' must have class/struct/union (1176)
Error C2228: left of '.shouldDebugBreak' must have class/struct/union (1177)
Error C2065: '__catchResult': undeclared identifier (1177)
Error C2228: left of '.reactWithoutDebugBreak' must have class/struct/union (1177)
philsquared commented 7 years ago

Scratch the NOMINMAX claim - seems it is still necessary :-( But, anyway, I just built an MFC app with the latest Catch, with #define NOMINMAX at the start of my stdafx.h and it builds cleanly.

I'm not sure where your errors are coming from but it looks like there might be some contextual issue - perhaps an unclosed construct before the inclusion? Do you still have #include "Test1.h" before you include Catch? Perhaps put that after and see if it makes a difference?

philsquared commented 7 years ago

Ah, I think I may know what the problem is! Looks like you need to grab the latest version of catch_reporter_teamcity.hpp, too (it's not part of the single header)!

PRGWITHSTYLE commented 7 years ago

I don't actually do that anymore I have it placed after the catch include, and i have the latest teamcity reporter from 5 months ago from the include.reporters folder.

philsquared commented 7 years ago

Sorry, I think I might be confusing things here. From your original description you're using v1.10, and the release I just directed you to is from the v2 (pre-release) branch! That's why the (v1) TeamCity reporter is breaking.

If you're happy to stick with v2, then please grab the latest TeamCity build from the Catch2 branch. Otherwise, and in the meantime, I'll take a look to see if v1 builds with MFC for me here...)

Again, sorry for the confusion!

PRGWITHSTYLE commented 7 years ago

Version 1.10 seems to work perfectly I took you advise and downloaded version 2.0 and the latest teamcity reporter from the version 2.0 zip file and now it just won't compile:

With nominmax defined i get:

Error C2039: 'ResultBuilder': is not a member of 'Catch' (1151)
Error C2065: 'ResultBuilder': undeclared identifier (1151)
Error C2146: syntax error: missing ';' before identifier '__catchResult' (1151)
Error C3861: '__catchResult': identifier not found (1151)
Error C2065: '__catchResult': undeclared identifier (1153)
Error C2065: '__catchResult': undeclared identifier (1154)
Error C2228: left of '.captureResult' must have class/struct/union (1154)
Error C2065: '__catchResult': undeclared identifier (1155)
Error C2228: left of '.shouldDebugBreak' must have class/struct/union (1155)
Error C2228: left of '.reactWithoutDebugBreak' must have class/struct/union (1155)
Error C2039: 'ResultBuilder': is not a member of 'Catch' (1161)
Error C2065: 'ResultBuilder': undeclared identifier (1161)
Error C2146: syntax error: missing ';' before identifier '__catchResult' (1161)
Error C3861: '__catchResult': identifier not found (1161)
Error C2065: '__catchResult': undeclared identifier (1164)
Error C2065: '__catchResult': undeclared identifier (1165)
Error C2228: left of '.captureResult' must have class/struct/union (1165)
Error C2065: '__catchResult': undeclared identifier (1166)
Error C2228: left of '.shouldDebugBreak' must have class/struct/union (1166)
Error C2228: left of '.reactWithoutDebugBreak' must have class/struct/union (1166)
Error C2039: 'ResultBuilder': is not a member of 'Catch' (1172)
Error C2065: 'ResultBuilder': undeclared identifier (1172)
Error C2146: syntax error: missing ';' before identifier '__catchResult' (1172)
Error C3861: '__catchResult': identifier not found (1172)
Error C2065: '__catchResult': undeclared identifier (1175)
Error C2065: '__catchResult': undeclared identifier (1176)
Error C2228: left of '.captureResult' must have class/struct/union (1176)
Error C2065: '__catchResult': undeclared identifier (1177)
Error C2228: left of '.shouldDebugBreak' must have class/struct/union (1177)
Error C2228: left of '.reactWithoutDebugBreak' must have class/struct/union (1177)

And without it I get:

Error C2062: type 'double' unexpected (1826)
Error C2062: type 'double' unexpected (1826)
Error C2059: syntax error: ')' (1826)
Error C2059: syntax error: ')' (1826)
Error C2062: type 'double' unexpected (3982)
Error C2059: syntax error: ')' (3982)
Error C2447: '{': missing function header (old-style formal list?) (3982)
Error C2143: syntax error: missing ';' before '{' (3982)
Error C2589: '(': illegal token on right side of '::' (5431)
Error C2059: syntax error: '::' (5431)
Error C2334: unexpected token(s) preceding ':'; skipping apparent function body (7193)
Error C2059: syntax error: ')' (7193)
Error C2143: syntax error: missing ')' before ';' (7204)
Error C2059: syntax error: ')' (7204)
Error C2238: unexpected token(s) preceding ';' (7204)
Error C2143: syntax error: missing ';' before 'namespace' (7211)
Error C2143: syntax error: missing ';' before '{' (7221)
Error C2447: '{': missing function header (old-style formal list?) (7221)
Error C2065: 'result_type': undeclared identifier (7221)
Error C2039: '()': is not a member of 'Catch::RandomNumberGenerator' (7221)
Error C2146: syntax error: missing ')' before identifier 'n' (7221)
Error C2039: '()': is not a member of 'Catch::RandomNumberGenerator' (7224)
Error C2270: '()': modifiers not allowed on nonmember functions (7224)
Error C2059: syntax error: ')' (7225)
Error C2555: 'Catch::Catch::TestRegistry::getAllTests': overriding virtual function return type differs and is not covariant from 'Catch::ITestCaseRegistry::getAllTests' (7258)
Error C3668: 'Catch::Catch::TestRegistry::getAllTestsSorted': method with override specifier 'override' did not override any base class methods (7259)
Error C2555: 'Catch::Catch::TagAliasRegistry::find': overriding virtual function return type differs and is not covariant from 'Catch::ITagAliasRegistry::find' (7338)
Error C2555: 'Catch::Catch::`anonymous-namespace'::RegistryHub::getStartupExceptionRegistry': overriding virtual function return type differs and is not covariant from 'Catch::IRegistryHub::getStartupExceptionRegistry' (7388)
Error C3668: 'Catch::Catch::`anonymous-namespace'::RegistryHub::registerTest': method with override specifier 'override' did not override any base class methods (7399)
Error C2259: 'Catch::Catch::TestRegistry': cannot instantiate abstract class (7413)
Error C2259: 'Catch::Catch::`anonymous-namespace'::RegistryHub': cannot instantiate abstract class (7424)
Error C2440: 'initializing': cannot convert from 'Catch::IMutableContext' to 'Catch::Catch::IMutableContext &' (7657)
Error C2439: 'Catch::Catch::RunContext::m_context': member could not be initialized (7657)
Error C2228: left of '.setRunner' must have class/struct/union (7658)
Error C2027: use of undefined type 'Catch::Catch::IMutableContext' (7658)
Error C2027: use of undefined type 'Catch::Catch::IMutableContext' (7659)
Error C2228: left of '.setConfig' must have class/struct/union (7659)
Error C2027: use of undefined type 'Catch::Catch::IMutableContext' (7660)
Error C2228: left of '.setResultCapture' must have class/struct/union (7660)
Error C2027: use of undefined type 'Catch::Catch::TestCase' (7682)
Error C2228: left of '.getTestCaseInfo' must have class/struct/union (7682)
Error C2512: 'Catch::TestCaseInfo': no appropriate default constructor available (7682)
Error C2227: left of '->getTestCaseInfo' must point to class/struct/union/generic type (7731)
Error C2228: left of '.okToFail' must have class/struct/union (7731)
Error C2027: use of undefined type 'Catch::Catch::TestCase' (7731)
Error C2027: use of undefined type 'Catch::Catch::TestCase' (7812)
Error C2227: left of '->getTestCaseInfo' must point to class/struct/union/generic type (7812)
Error C2228: left of '.name' must have class/struct/union (7813)
Error C2027: use of undefined type 'Catch::Catch::TestCase' (7839)
Error C2227: left of '->getTestCaseInfo' must point to class/struct/union/generic type (7839)
Error C2530: 'testCaseInfo': references must be initialized (7839)
Error C2228: left of '.description' must have class/struct/union (7840)
Error C2512: 'Catch::SectionInfo::SectionInfo': no appropriate default constructor available (7840)
Error C3536: 'testCaseInfo': cannot be used before it is initialized (7840)
Error C2228: left of '.lineInfo' must have class/struct/union (7840)
Error C2228: left of '.name' must have class/struct/union (7840)
Error C2530: 'testInfo': references must be initialized (7847)
Error C2227: left of '->getTestCaseInfo' must point to class/struct/union/generic type (7847)
Error C2027: use of undefined type 'Catch::Catch::TestCase' (7847)
Error C3536: 'testInfo': cannot be used before it is initialized (7852)
Error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'Catch::TestCaseStats' (7856)
Error C2027: use of undefined type 'Catch::Catch::TestCase' (7881)
Error C2227: left of '->getTestCaseInfo' must point to class/struct/union/generic type (7881)
Error C2530: 'testCaseInfo': references must be initialized (7881)
Error C3536: 'testCaseInfo': cannot be used before it is initialized (7882)
Error C2228: left of '.lineInfo' must have class/struct/union (7882)
Error C2228: left of '.name' must have class/struct/union (7882)
Error C2228: left of '.description' must have class/struct/union (7882)
Error C2512: 'Catch::SectionInfo::SectionInfo': no appropriate default constructor available (7882)
Error C2679: binary '=': no operator found which takes a right-hand operand of type 'initializer list' (or there is no acceptable conversion) (7888)
Error C2228: left of '.lineInfo' must have class/struct/union (7888)
Error C2668: 'Catch::Catch::seedRng': ambiguous call to overloaded function (7890)
Error C2027: use of undefined type 'Catch::Catch::TestCase' (7927)
Error C2227: left of '->invoke' must point to class/struct/union/generic type (7927)
Error C2888: 'Catch::Section::Section(const Catch::SectionInfo &)': symbol cannot be defined within namespace 'Catch' (7955)
Error C2888: 'Catch::Section::~Section(void)': symbol cannot be defined within namespace 'Catch' (7965)
Error C2888: 'Catch::Section::operator bool(void) const': symbol cannot be defined within namespace 'Catch' (7979)
Error C2888: 'Catch::SectionInfo::SectionInfo(const Catch::SourceLineInfo &,const std::string &,const std::string &)': symbol cannot be defined within namespace 'Catch' (7993)
Error C2888: 'Catch::SectionEndInfo::SectionEndInfo(const Catch::SectionInfo &,const Catch::Counts &,double)': symbol cannot be defined within namespace 'Catch' (7999)
Error C2873: 'IStreamingReporterPtr': symbol cannot be used in a using-declaration (8082)
Error C2039: 'IStreamingReporterPtr': is not a member of 'Catch::Catch' (8082)
Error C2873: 'IConfigPtr': symbol cannot be used in a using-declaration (8083)
Error C2039: 'IConfigPtr': is not a member of 'Catch::Catch' (8083)
Error C2873: 'Config': symbol cannot be used in a using-declaration (8084)
Error C2039: 'Config': is not a member of 'Catch::Catch' (8084)
Error C2039: 'ReporterConfig': is not a member of 'Catch::Catch' (8113)
Error C2039: 'Totals': is not a member of 'Catch::Catch' (8116)
Error C2664: 'Catch::Totals Catch::Catch::RunContext::runTest(const Catch::Catch::TestCase &)': cannot convert argument 1 from 'const Catch::TestCase' to 'const Catch::Catch::TestCase &' (8134)
Error C2872: 'TestCase': ambiguous symbol (8145)
Error C2440: 'const_cast': cannot convert from 'const std::vector<Catch::Catch::TestCase,std::allocator<_Ty>>' to 'std::vector<Catch::TestCase,std::allocator<_Ty>> &' (8145)
Error C2530: 'tests': references must be initialized (8145)
Error C3312: no callable 'end' function found for type 'int' (8146)
Error C3536: 'tests': cannot be used before it is initialized (8146)
Error C3312: no callable 'begin' function found for type 'int' (8146)
Error C2065: 'testCase': undeclared identifier (8147)
Error C2228: left of '.tags' must have class/struct/union (8147)
Error C2065: 'testCase': undeclared identifier (8149)
Error C2228: left of '.lineInfo' must have class/struct/union (8149)
Error C2228: left of '.file' must have class/struct/union (8149)
Error C3536: 'tags': cannot be used before it is initialized (8161)
Error C2228: left of '.push_back' must have class/struct/union (8161)
Error C2065: 'testCase': undeclared identifier (8162)
Error C2039: 'cout': is not a member of 'Catch::Catch' (8182)
Error C1003: error count exceeds 100; stopping compilation (8182)
philsquared commented 7 years ago

I'm really sorry you're having these ongoing issues.

I've just added the team city reporter to my test MFC app and it all works fine for me. But I looked in my catch.hpp at some of the line numbers from your error messages and they don't see to correspond. Can you confirm that you have v2.0.0-develop.5? (check in catch.hpp, in the comment header right at the top of the file).

PRGWITHSTYLE commented 7 years ago

This is the commented text above: *

philsquared commented 7 years ago

Looking at your errors again I see mention of ResultBuilder. That class no longer exists in Catch2. Do you have any other Catch files in your project (other than catch.hpp and catch_reporters_teamcity.hpp)? Do you have any custom code in your project that uses types like Catch::ResultBuilder?

PRGWITHSTYLE commented 7 years ago

Thank you! it seems that fakeit the mocking framework was causing the build failure but if I include NOMINMAX it build perfectly if I remove it still experience the same issues as before.

philsquared commented 7 years ago

yes, I discovered that to use std::shuffle we have to pass in an instance of a class with methods min and max, so we're still susceptible (but now Catch2 is on C++11 I may be able to remove that).

Glad to hear it's all building for you from Catch2, now. Catch2 will become the master branch quite soon, so I didn't want you to get stranded on the legacy branch.