Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation failed under VS2015 with master #794

Open
git45016683 opened this issue Jul 26, 2023 · 2 comments
Open

Compilation failed under VS2015 with master #794

git45016683 opened this issue Jul 26, 2023 · 2 comments

Comments

@git45016683
Copy link

Description

I work on VS2015,and i want to make some unittest with doctest for my project。
I open doctest.sln with VS2015 and build it after configure doctest with CMake on VS2015, but it compilation failed,it show so maby error messages like below:

‘’‘
doctest_fwd.h(2194): error C2220: 警告被视为错误 - 没有生成“object”文件
doctest_fwd.h(2194): warning C4668: 没有将“_MSVC_LANG”定义为预处理器宏,用“0”替换“#if/#elif”
doctest.cpp(194): error C2059: 语法错误:“<L_ATTRIBUTE_SPECIFIER>”
doctest.cpp(194): error C2893: 未能使函数模板“void doctest::`anonymous-namespace'::throw_exception(const Ex &)”专用化
s\doctest.cpp(194): note: 用下列模板参数:
s\doctest.cpp(194): note: “Ex=std::logic_error”
’‘’

Steps to reproduce

  1. git clone doctest
  2. configure doctest with CMake(VS2015 && Win32)
  3. open doctest.sln with VS2015 and build all(i want to run example but example build failed too)
  4. build failed,show error message like above

Extra information

  • doctest version: master
  • Operating System: Win11
  • Compiler+version: Microsoft Visual Studio Community 2015/版本 14.0.23107.0 D14REL/Visual C++ 2015 00322-20000-00000-AA666
@git45016683
Copy link
Author

git45016683 commented Jul 26, 2023

and i wrote a test demo include doctest.h (v2.4.9) with VS2015, it built failed, show error message like below:

doctestdemo0\doctest.h(3238): error C2059: 语法错误:“<L_ATTRIBUTE_SPECIFIER>”
doctestdemo0\doctest.h(3238): error C2893: 未能使函数模板“void doctest::`anonymous-namespace'::throw_exception(const Ex &)”专用化
doctestdemo0\doctest.h(3238): note: 用下列模板参数:
doctestdemo0\doctest.h(3238): note: “Ex=std::logic_error”
doctestdemo0\doctest.h(3282): fatal error C1075: 左侧的 大括号“{” 与文件结尾不匹配

demo code just like:

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"

int fact(int n) { return (n <= 1) ? n : fact(n-1)*n; }

TEST_CASE("test_doctest") {
	CHECK(fact(1) == 1);
}

@git45016683
Copy link
Author

update:
doctest build succeed after i built it with VS2022;
so i want to know which version can build with VS2015, because README talk us doctest support VS2015.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant