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

Compiling with DOCTEST_CONFIG_COLORS_ANSI fails on Windows #348

Closed
psfrolov opened this issue Mar 8, 2020 · 0 comments
Closed

Compiling with DOCTEST_CONFIG_COLORS_ANSI fails on Windows #348

psfrolov opened this issue Mar 8, 2020 · 0 comments

Comments

@psfrolov
Copy link

psfrolov commented Mar 8, 2020

Description

The following code fails on Windows with MSVC because STDOUT_FILENO is not defined.

#define DOCTEST_CONFIG_COLORS_ANSI
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>

Workaround

#ifdef _WIN32
#include <cstdio>
const int STDOUT_FILENO{fileno(stdout)};
#endif

#define DOCTEST_CONFIG_COLORS_ANSI
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>

Fix

Replace STDOUT_FILENO with fileno(stdout) in doctest. This should work across platforms.

@psfrolov psfrolov changed the title Compiling with DOCTEST_CONFIG_COLORS_ANSI fails in Windows Compiling with DOCTEST_CONFIG_COLORS_ANSI fails on Windows Mar 8, 2020
onqtam added a commit that referenced this issue May 17, 2020
@onqtam onqtam closed this as completed May 17, 2020
onqtam added a commit that referenced this issue May 17, 2020
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

2 participants