Get that Linux feeling - in Windows!
Cygwin is...
- a collection of tools which provide a Linux look and feel environment for Windows.
- a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality.
Cygwin isn't...
- a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
- a way to magically make native Windows apps aware of UNIX® functionality like signals, ptys, etc. Again, you need to build your appsfrom source if you want to take advantage of Cygwin functionality.
The Cygwin DLL currently works with all recent, commercially released x86 32 bit and 64 bit versions of Windows, with the exception of Windows CE and Windows NT4.
- For more information see the FAQ.
Installation
- Go to http://cygwin.com/install.html and download the setup.exe
- Then run it,you'll get this window,press run.
- Then continue with the installation ,use standard settings.
- When you get to the Cygwin Setup - Select Packages window,from which you can select components you want to install.
The default components and the "gcc-core: C Compiler" will be all we want.
To select this component, click the plus sign (+) next to the Devel category and scroll down until you find the gcc-core:C Compiler component.Click the word "skip" to select the component for installation.
- Then you can continue your installation without any difficulty in the normal way.
- Depending on your specific installation (Cygwin version) and configuration (components selected) of Cygwin, you may need to have Cygwin’s bin directory, referenced next, added to your system’s PATH environment variable.
One trick is to launch a Microsoft-based command shell (DOS window) by typing the keyword "cmd" from the Run dialog box accessed via the Start menu.From the c:\ prompt (in the command
shell), type:
PATH %PATH%;c:\cygwin\bin
This should do the trick.If necessary, consult your system’s documentation for more information on environment variables and specifically updating the PATH system variable.
________________________________________________________________
Writing & Compiling a C program...
- To create a new C program invoke a text editor such as nano or VIM by the command shown below.
nano hello.c or vim hello.c
- Once you've created a C program using an editor,you are ready to compile your C program using gcc. To do that type the following from the Cygwin UNIX shell:
- if your program compiles successfully, gcc will create a new executable file called "a.exe".(maybe "a.out").
- There is a specified syntax to create a executable file with a unique name
gcc programName -o executableName
so according to our example:
gcc hello.c -o hello.exe
- To execute your program from Cygwin UNIX prompt,type in the following:
./hello
Now you can easily use Cygwin to write , compile and run a C program.So if you find this useful, please don't forget to like and share it with others...
Thanks.
No comments:
Post a Comment