window cygwin c环境搭建

https://cygwin.com/install.html
下载32 或者64位
下载cygwin,在选择从internet下载的时候建议添加镜像站,提高下载速度
http://mirrors.163.com/.help/cygwin.html
选择从互联网安装, 在"User URL"处输入以下地址
http://mirrors.163.com/cygwin/
在搜索输入框搜索下面的东西然后点击Skip就会变成一个版本号, 而右边有一个bin,出现了一个x,再点击可能会出现版本号变化,甚至 New的字段会出现src源代码也勾选,然后最后又变成了skip,也就是不下载,按照国际惯例教程,都是选择带gun字样的进行安装,
搜索的时候View选择full,

gcc, gcc-core, gcc-g++, gcc-mingw-core, gcc-mingw-g++, make , gdb, binutils
我就下载了gcc-core,gcc-g++, make ,gdb
如果在eclipse跑起来出现了一个问题也就是cygwin提示的问题的话说明没有安装好,我刚开始的时候以为搜索需要按回车键结果直接就下载某些东西了,导致一直报错,后面我把cygwin目录删除了重新装了一遍才好。
然后在eclipse点击锤子就可以进行编译了,然后点击源文件->运行就可以看到控制台输出了.
下一步就会进行下载
最后就完成安装了,
当下次还需要安装的时候可以重新打开安装包,默认将识别上次的配置。
配置环境变量
类似这样的路径
F:\cygwin64\bin;
然后控制台输入make -version
出现了下面的类似就是代表make成功了 输入gcc --version如果能看到版本号也说明gcc也成功下载了

C:\Users\Administrator>make -version
GNU Make 4.2.1
Built for x86_64-unknown-cygwin
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
C:\Users\Administrator>gcc --version
gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

下面是点击完成输出的一些东西。

binutils    (2.25-4)
    GNU assembler, linker, and similar utilities
    Required by: gcc-core, python, python2

bzip2   (1.0.6-3)
    BZip file de/compressor
    Required by: tar

ca-certificates (2.14-1)
    CA root certificates
    Required by: libopenssl100

cygwin-devel    (2.8.2-1)
    Core development files
    Required by: gcc-core, python

groff   (1.22.3-1)
    GNU roff formatter
    Required by: man-db

less    (487-1)
    A file pager program, similar to more(1)
    Required by: man-db

libargp (20110921-3)
    Interface for parsing command-line arguments
    Required by: getent

libatomic1  (5.4.0-1)
    GCC C11/C++11 locked atomics runtime library
    Required by: gcc-core

libattr1    (2.4.46-1)
    Shared lib for managing filesystem extended attributes
    Required by: coreutils

libblkid1   (2.25.2-2)
    Block device ID library (runtime)
    Required by: util-linux

libbz2_1    (1.0.6-3)
    BZip file de/compressor
    Required by: python, bzip2, python2

libcrypt0   (1.4-1)
    Encryption/Decryption utility and library
    Required by: python, libguile17, libguile2.0_22, python2

libdb5.3    (5.3.28-1)
    Oracle Berkeley DB (runtime)
    Required by: python, python2

libexpat1   (2.2.3-1)
    Expat XML parser library (shared library)
    Required by: gdb, python, python2

libffi6 (3.2.1-2)
    Portable foreign function interface library
    Required by: python, libguile2.0_22, python2, libp11-kit0

libgc1  (7.6.0-1)
    Boehm-Demers-Weiser garbage collector library
    Required by: libguile2.0_22

libgcc1 (5.4.0-1)
    GCC C runtime library
    Required by: gcc-core, libmpfr4, libgomp1, libquadmath0, libstdc++6, libncursesw10, libguile2.0_22, groff, libuuid1, libdb5.3, libgc1, libunistring2

libgdbm4    (1.12-1)
    GNU dbm implementation
    Required by: man-db, python, python2

libgmp10    (6.1.2-1)
    Library for arbitrary precision arithmetic (C runtime)
    Required by: coreutils, gawk, gcc-core, gcc-g++, libmpfr4, libisl13, libmpc3, libguile17, libguile2.0_22

libgomp1    (5.4.0-1)
    GCC OpenMP runtime library
    Required by: gcc-core

libguile17  (1.8.8-3)
    GNU Scheme interpreter library
    Required by: make

libguile2.0_22  (2.0.14-1)
    GNU Scheme interpreter library
    Required by: make

libiconv    (1.14-3)
    Unicode iconv() implementation
    Required by: man-db

libiconv2   (1.14-3)
    Unicode iconv() implementation
    Required by: alternatives, bash, coreutils, diffutils, gcc-core, gcc-g++, gdb, grep, info, man-db, tar, vim-minimal, libintl8, libpopt0, libguile2.0_22, groff, libiconv, libunistring2

libintl8    (0.19.8.1-2)
    GNU Internationalization runtime library
    Required by: alternatives, bash, coreutils, diffutils, findutils, gawk, gcc-core, gcc-g++, gdb, grep, info, make, man-db, sed, tar, util-linux, libattr1, libpopt0, binutils, python, libguile17, libguile2.0_22, libgdbm4, libiconv, xz, libblkid1, libsmartcols1, libuuid1, python2, libp11-kit0

libisl13    (0.14.1-1)
    Integer Set Library (runtime)
    Required by: gcc-core, gcc-g++

libltdl7    (2.4.6-4)
    Libtool dynamic library loader library (runtime)
    Required by: libguile17, libguile2.0_22

liblzma5    (5.2.3-1)
    LZMA de/compressor library (runtime)
    Required by: gdb, xz

libmpc3 (1.0.3-1)
    C library for multiple-precision floating-point computations with exact rounding (runtime)
    Required by: gcc-core, gcc-g++

libmpfr4    (3.1.5-1p10)
    A library for multiple-precision floating-point arithmetic with exact rounding (runtime)
    Required by: gawk, gcc-core, gcc-g++, libmpc3

libncursesw10   (6.0-11.20170617)
    Terminal display library
    Required by: gdb, info, libreadline7, ncurses, util-linux, vim-minimal, python, less, python2

libp11-kit0 (0.23.5-1)
    PKCS#11 module library
    Required by: p11-kit, p11-kit-trust

libpcre1    (8.40-3)
    Perl Compatible Regular Expressions UTF-8 runtime
    Required by: grep

libpipeline1    (1.4.0-1)
    C library for manipulating pipelines of subprocesses - runtime
    Required by: man-db

libpopt-common  (1.16-2)
    Command-line option parser library
    Required by: libpopt0

libpopt0    (1.16-2)
    Command-line option parser library
    Required by: cygutils

libquadmath0    (5.4.0-1)
    GCC Quad-Precision Math runtime library
    Required by: gcc-core

libsigsegv2 (2.10-2)
    Library for handling page faults in user mode (runtime)
    Required by: diffutils

libsmartcols1   (2.25.2-2)
    Tabular data formatting library (runtime)
    Required by: util-linux

libsqlite3_0    (3.19.3-1)
    An embeddable SQL database engine (library)
    Required by: python, python2

libssp0 (5.4.0-1)
    GCC Stack-Smashing Protection runtime library
    Required by: gcc-core, vim-minimal

libstdc++6  (5.4.0-1)
    GCC C++ runtime library
    Required by: gcc-g++, libncursesw10, groff, libdb5.3, libgc1

libtasn1_6  (4.12-1)
    ASN.1 library
    Required by: p11-kit, p11-kit-trust

libunistring2   (0.9.6-1)
    Library for manipulating Unicode strings - runtime
    Required by: libguile2.0_22

libuuid-devel   (2.25.2-2)
    Universally Unique ID library (development)
    Required by: python, python2

libuuid1    (2.25.2-2)
    Universally Unique ID library (runtime)
    Required by: util-linux, libblkid1, libuuid-devel

libvtv0 (5.4.0-1)
    GCC vtable verification library
    Required by: gcc-core

p11-kit (0.23.5-1)
    PKCS#11 module tool
    Required by: ca-certificates

p11-kit-trust   (0.23.5-1)
    PKCS#11 module library
    Required by: ca-certificates

python  (2.7.13-1)
    Obsoleted by python2
    Required by: gdb

python2 (2.7.13-1)
    Python 2 language interpreter
    Required by: python

tzcode  (2016j-1)
    Time Zone Database utilities
    Required by: coreutils

w32api-headers  (5.0.2-1)
    MinGW-w64 Windows API headers for Cygwin
    Required by: gcc-core, w32api-runtime

w32api-runtime  (5.0.2-1)
    MinGW-w64 Windows API import libraries for Cygwin
    Required by: gcc-core

windows-default-manifest    (6.4-1)
    Default Windows application manifest
    Required by: gcc-core

xz  (5.2.3-1)
    LZMA de/compressor
    Required by: tar

zlib0   (1.2.11-1)
    gzip de/compression library (runtime)
    Required by: file, gcc-core, gcc-g++, libopenssl100, man-db, util-linux, binutils, python, python2


用eclipse开发 c

http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr2
下载和电脑java 32或者64,一定要一样,不然会打开出现找不到jni xx .dll
新建C/C++项目
在Executable选项卡中可以看到右边 分别列出来了识别到的c编译器
Cross GCC Cygwin GCC Microsoft Visual C++
如果没有Cygwin说明环境变量的配置是有问题的.

如果还需要带java的话。。
http://www.eclipse.org/downloads/eclipse-packages/
下载java的se,然后再下载cdt插件。
http://www.eclipse.org/cdt/
http://www.eclipse.org/cdt/downloads.php
https://jingyan.baidu.com/article/456c463b67b4310a59314468.html
c代码hello world

#include <iostream>
using namespace std;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

我的做法是新建C++ Project ->Executable -Hello World C++ Project -ToolChains选择Cygwin GCC
点击Next会自动配置Source目录。
不然的话比较乱的,没有source目录的话。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,723评论 5 476
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,080评论 2 379
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 149,604评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,440评论 1 273
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,431评论 5 364
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,499评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,893评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,541评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,751评论 1 296
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,547评论 2 319
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,619评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,320评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,890评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,896评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,137评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,796评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,335评论 2 342

推荐阅读更多精彩内容