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

Build error with MinGW (Mingw-w64) due to missing Windows.h (with capital W) #370

Closed
jrosdahl opened this issue May 10, 2020 · 5 comments
Closed

Comments

@jrosdahl
Copy link

Description

After PR #336 it's no longer possible to use doctest for Win32 cross-compilation using e.g. Mingw-w64 on a case sensitive file system.

Steps to reproduce

On a Linux system (I'm currently using Ubuntu 19.10):

  1. git clone https://github.com/onqtam/doctest.git
  2. cd doctest
  3. printf '#define DOCTEST_CONFIG_IMPLEMENT\n#include "doctest/doctest.h"\n' >test.cpp
  4. i686-w64-mingw32-g++-posix -c test.cpp
  5. Watch the following output:
doctest/doctest.h:2766:10: fatal error: Windows.h: No such file or directory
 2766 | #include <Windows.h>
      |          ^~~~~~~~~~~
compilation terminated.

Using the lowercase version of windows.h works:

  1. sed -i 's/Windows\.h/windows.h/' doctest/doctest.h
  2. i686-w64-mingw32-g++-posix -c test.cpp && echo success (prints success)

Extra information

  • doctest version: v2.3.7 or latest master (932a2ca at the time of writing)
  • Operating System: Ubuntu 19.10
  • Compiler+version: i686-w64-mingw32-g++-posix (GCC) 9.2-posix 20191008

Maybe of interest:

@onqtam
Copy link
Member

onqtam commented May 10, 2020

Oh gosh...... I'll fix this in the coming days - I hope I don't ever forget that and switch it back because of "compiler warnings"...

Thanks for reporting!

@onqtam
Copy link
Member

onqtam commented May 11, 2020

pushed in the dev branch

@u3shit
Copy link

u3shit commented Jan 16, 2021

Okay, I think I've also got hit by this change. The only problem is that I use clang so I don't have those fancy mingw defines. Why can't we just use the lowercase windows.h always? Even microsoft itself isn't consistent about the casing of this file.

@onqtam
Copy link
Member

onqtam commented Jan 17, 2021

@u3shit Just pushed a fix in the dev branch - always using lowercase and no ifdefs (along with silencing the Wnonportable-system-include-path warning for clang which was the reason for the capital W) - will probably release an official version in master by the end of the month.

@u3shit
Copy link

u3shit commented Jan 17, 2021

@onqtam checked it, it fixes the issue for me 👍

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

3 participants