How to use POSIX under Windows?

Native Windows system has poor support for C and POSIX currently. Maybe MS has noticed this situation and begins converting it. There are two methods to utilize POSIX under Windows.

1.windows subsystem for linux
https://docs.microsoft.com/en-us/windows/wsl/install-win10

At the present, the following Linux distributions are supported.
Ubuntu 16.04 LTS
Ubuntu 18.04 LTS
OpenSUSE Leap 15
OpenSUSE Leap 42
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 15
Kali Linux
Debian GNU/Linux
Fedora Remix for WSL
Pengwin
Pengwin Enterprise
Alpine WSL

2.Cygwin/Cygwin64
It implements POSIX APIs using Windows functions. Both the installation and update are easy. It contains rich functions which are the same as under Linux. MS is said to only support C89 standard. If you’d like to use features of C99/C11 or the latest GCC/Clang compiler, Cygwin may be your choice.

If u compile under Cygwin, your program will rely on cygwin.dll which has the license similar to GPL. So u need to release your source code if u distribute DLL library stripped from Cygwin. And you have to pay to avoid this.

https://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/

The commands I prefer are as follows:
C:\cygwin64>setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel

Compling C Program not under POSIX environment on Windows
The answer is MinGW(Minimalist GNU for Windows), which provides a standard C compiler and some utilities. Meanwhile, Accompanying Msys provides other tools such as shell.

IDEs for MinGW on Windows: Code:blocks, Eclipse

As MinGW lacks precompiled libraries, u may have to download and compile source code of needed libraries manually, while using other package manager, u just need to input a single command.

References:
21st Century C

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值