Cygwin

Cygwin是用一个dll模拟linux环境来”欺骗”应用程序,好像自己运行在linux环境下;而mingw是在编译时提供linux到windows必要代码的”翻译”转换,用到的还是windows运行时库.在cygwin下编译出来的程序需要cygwin.dll才能在windows下运行,
源码拿到linux环境下重新编译就可以在linux下跑起来;mingw环境下编译出来的程序,只能在windows下跑,源码在linux环境下编译多半通不过.

http://www.cygwin.com/

Window 环境搭建

  1. 下载 http://www.cygwin.com/setup-x86_64.exe
    安装到默认路径 C:\cygwin64 ,不要安装到 C:\Program File 下,因为中间有空格字符问题

安装 Clion 的时候,提示 GDB not found make gcc++ 未找到等错误
重新运行安装 Cygwin 的时候 选择 Devel 下相应的子安装包即可
Important: For programmers, you certainly need to open the “Devel” (Development) category and select “gcc”, “g++”, “gdb”, “make”, “cmake”, and others, which are not part of the default selection.
Browse thru all the categories. Complete the installation process. You can always re-run “setup.exe” to install additional packages later.

  1. 添加 C:\cygwin64\bin 到系统环境变量 PATH

参考
Cygwin & MinGW (for Windows)
clion-installation-cmake-compilers-not-found-gdb-not-found
Cygwin和MinGW的区别与联系
How to setup Clion for compile and RUN

JetBrains C++ IDE CLion配置与评测

错误问题分析

重新全部安装Devel后重新使用CLion编译项目出现如下错误:

1
Compilation error: "stddef.h: No such file or directory"

搜索原因是 gcc-core 和 gcc-g++ 版本不一致导致的原因
重新下载运行 setup-x86_64.exe Cygwin 安装程序,发现 gcc-coregcc-g++ 都是 4.9.2-3 ,于是重新安装一遍,还是没有解决问题,根据网友提示有两份不同版本的 gcc~需要卸掉重装,
于是重新运行 setup-x86_64.exe Cygwin 安装程序,取消勾选 gcc-coregcc-g++ 相关(表示卸载),安装/卸载完成后没有重新运行安装程序,重新编译通过项目也没有报错

参考
cygwin下g++的一个错误
Compilation error: “stddef.h: No such file or directory”

文章目录
  1. 1. Window 环境搭建
  2. 2. 错误问题分析