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.phphttps://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目录的话。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值