Chapter 3 Cygwin—a linux-Like Environment for Windows

Download 18.05 Kb.
Size18.05 Kb.

Chapter 3
Cygwin—A Linux-Like Environment for Windows

Cygwin is a tool that runs under Windows that is similar to a Linux shell where you can use most of the UNIX commands. It allows the programmer to test, debug, compile and run C/C++ programs much like doing so in UNIX.

3.1 What is Cygwin?
Taken from “The Cygwin tools are ports of the popular GNU development tools for Microsoft Windows. They run thanks to the Cygwin library which provides the UNIX system calls and environment these programs expect.

With these tools installed, it is possible to write Win32 console or GUI applications that make use of the standard Microsoft Win32 API and/or the Cygwin API. As a result, it is possible to easily port many significant UNIX programs without the need for extensive changes to the source code. This includes configuring and building most of the available GNU software (including the packages included with the Cygwin development tools themselves). Even if the development tools are of little to no use to you, you may have interest in the many standard UNIX utilities provided with the package. They can be used either from the bash shell (provided) or from the standard Windows command shell.

3.2 What versions of Windows are supported?
Cygwin can be expected to run on all modern 32 bit versions of Windows, except Windows CE. This includes Windows 95/98/ME/NT/2000/XP/2003 and the WOW64 32 bit environment on released 64 bit versions of Windows. As far as we know no one is working on a native 64 bit version of Cygwin. Since Cygwin is a community-supported free software project, patches to provide support for other versions would be thoughtfully considered. Paid support contracts or enhancements are available through Red Hat. For information about getting a Red Hat support contract, see
Keep in mind that Cygwin can only do as much as the underlying OS supports. Because of this, Cygwin will behave differently, and exhibit different limitations, on the various versions of Windows.
3.3 Where can I get a copy of Cygwin?
Besides the accompanied CD with this manual, Cygwin is freeware and can be downloaded from There you should find everything you need for Cygwin, including links for download and setup, a current list of mirror sites, a User's Guide, an API Reference, mailing lists and archives, and additional ported software. You can also find documentation for the individual GNU tools at (You should read GNU manuals from a local mirror. Check for a list of them.)”
3.4 Cygwin Tools
Cygwin includes a collection of tools, which provide Linux look and feel. These tools are stored inside the bin/ sub-folder inside the Cygwin main folder installation drive. Some of these tools are (make, ls, cd, pwd, gcc, pilrc, mkdir, and many other commands) which are listed in Figure 1 below. The Cygwin shell looks like the following:

Figure 1: Contents of bin/ subfolder under Cygwin installation folder
As shown in Figure 1 a number of tools are listed and may be used as needed. The main tools inside this directory are the PRC-tools needed to compile and generate a Palm OS application executable (the .prc file).

    1. Cygwin Shell

The cygwin icon look like this: .

Double-click on the cygwin icon to start its shell, which looks like the one shown in the figure below. As illustrated, various cygwin/UNIX commands can be used, some of which are specifically known to generate a Palm executable, and others for file management and so on.

Figure 2: Cygwin Shell
The main characteristic of the Cygwin shell is that it does not offer an IDE capability. It is fully command-line driven. The programmer has to type in the commands at the prompt in order to compile, post process, and post link the entire Palm application to generate the executable.

As described in section 1.5 of chapter 1, the tools needed to generate the Palm executable were:

a) PRC-tools:

m68k-palmos-gcc (C Compiler)

m68k-palmos-obj-res (Post-Processor)

PilRC (UI Resource Compiler)

Build-PRC(PalmOS Post-Linker)

  1. Command-line debugger

  1. Test and run the executable may be done using one of the following platforms (Figure 3):

a) Simulator b) Emulator c) PDA (HotSync)

Figure 3: Palm OS Test Tools (Cygwin Shell, Simulator, Emulator, & HotSync)

3.6 Compiling a Palm OS Application using the Cygwin Shell

  1. Make sure Pilrc is installed with your Cygwin program.

  2. If the compiler gives you an error indicating Pilrc is missing then you know it is not included in your Cygwin program.

  3. Install Pilrc from this site or from the book CD (the installation procedure will be shown further in the next step).

  1. Make sure you install Pilrc inside the folder C:\PalmOSCygwin.

It will create the folder pilrc-3.2\ inside C:\PalmOSCygwin\

  1. Copy the file pilrc.exe into C:\PalmOSCygwin\bin\

  1. You are all set! You should no longer get the Pilrc error. See Figure 4.

Figure 4: Compiling a Palm Application at the Cygwin Shell
3.7 Installing the Resource Compiler Pilrc
Pilrc is a resource compiler. There is no need to install it if you already downloaded Palm OS Developer Studio. However, you need to install Pilrc only if you have a Pilrc error when you attempt to build the project in Developer Studio.
The Pilrc error in Developer Studio means that the Pilrc executable is missing from Developer Studio's Cygwin tool. If so, then install the Pilrc tool and then look for and copy pilrc.exe into the bin/ directory inside C:\PalmOSCygwin).
Once pilrc.exe is stored inside the C:\PalmOSCygwin\bin\ folder, rebuild the project again. The palm executable (.prc file) should be generated without any errors.
3.8 Cygwin References
To obtain a free copy of the latest version of Cygwin and latest information and news about it, the following links are most useful sites about Cygwin:





Download 18.05 Kb.

Share with your friends:

The database is protected by copyright © 2020
send message

    Main page