window cygwin c環(huán)境搭建

https://cygwin.com/install.html
下載32 或者64位
下載cygwin,在選擇從internet下載的時(shí)候建議添加鏡像站,提高下載速度
http://mirrors.163.com/.help/cygwin.html
選擇從互聯(lián)網(wǎng)安裝, 在"User URL"處輸入以下地址
http://mirrors.163.com/cygwin/
在搜索輸入框搜索下面的東西然后點(diǎn)擊Skip就會(huì)變成一個(gè)版本號(hào), 而右邊有一個(gè)bin,出現(xiàn)了一個(gè)x,再點(diǎn)擊可能會(huì)出現(xiàn)版本號(hào)變化,甚至 New的字段會(huì)出現(xiàn)src源代碼也勾選,然后最后又變成了skip,也就是不下載,按照國(guó)際慣例教程,都是選擇帶gun字樣的進(jìn)行安裝,
搜索的時(shí)候View選擇full,

gcc, gcc-core, gcc-g++, gcc-mingw-core, gcc-mingw-g++, make , gdb, binutils
我就下載了gcc-core,gcc-g++, make ,gdb
如果在eclipse跑起來(lái)出現(xiàn)了一個(gè)問(wèn)題也就是cygwin提示的問(wèn)題的話說(shuō)明沒有安裝好,我剛開始的時(shí)候以為搜索需要按回車鍵結(jié)果直接就下載某些東西了,導(dǎo)致一直報(bào)錯(cuò),后面我把cygwin目錄刪除了重新裝了一遍才好。
然后在eclipse點(diǎn)擊錘子就可以進(jìn)行編譯了,然后點(diǎn)擊源文件->運(yùn)行就可以看到控制臺(tái)輸出了.
下一步就會(huì)進(jìn)行下載
最后就完成安裝了,
當(dāng)下次還需要安裝的時(shí)候可以重新打開安裝包,默認(rèn)將識(shí)別上次的配置。
配置環(huán)境變量
類似這樣的路徑
F:\cygwin64\bin;
然后控制臺(tái)輸入make -version
出現(xiàn)了下面的類似就是代表make成功了 輸入gcc --version如果能看到版本號(hào)也說(shuō)明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.

下面是點(diǎn)擊完成輸出的一些東西。

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開發(fā) c

http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr2
下載和電腦java 32或者64,一定要一樣,不然會(huì)打開出現(xiàn)找不到j(luò)ni xx .dll
新建C/C++項(xiàng)目
在Executable選項(xiàng)卡中可以看到右邊 分別列出來(lái)了識(shí)別到的c編譯器
Cross GCC Cygwin GCC Microsoft Visual C++
如果沒有Cygwin說(shuō)明環(huán)境變量的配置是有問(wèn)題的.

如果還需要帶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
點(diǎn)擊Next會(huì)自動(dòng)配置Source目錄。
不然的話比較亂的,沒有source目錄的話。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容