Skip to content

How to detect if running under WSL? #4071

@AgnerF

Description

@AgnerF

How do you detect if running under WSL?

C compilers in Mingw and Cygwin have preprocessing defines that allow you to identify the system. Is there a WSL preprocessing define or some other method for identifying the system? If not, please make a preprocessing define that gives a WSL version number.

You may claim that this is a genuine Linux (Ubuntu or whatever), but it is not. The floating point control word is set to reduced precision, and this causes a lot of problems. (Why has issue #830 never been fixed?). Also, of course, there is no GUI in WSL.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions