The UnStudio - Windows Programing with DevC++

Hugh Sparks
Version 1.0, February 20, 2003

UPDATE

UPDATE: DevC++ has fallen out of existance. But a new open source project has taken its place:

wxDevC++

I will update this site Real Soon Now™ with further news...

Introduction

DevC++ is a complete and free software development environment for Windows programing. It features syntax highlighting, source level debugging, integration with CVS and many other features.

DevC++ is based on the MinGW port of the GNU GCC compiler tools. Currently, C, C++ and Pascal are supported. With little effort, any other GCC-based languages could be added.

If you find Microsoft Visual Studio.Net a bit too much, you'll really appreciate DevC++. All Win32 header files and libraries are included. Every Visual Studio project I've moved to DevC++ has compiled and run without editing the C source files.

This page is not the primary source for Dev++ and the associated packages. It is simply a quick start guide and collection of links. The download links provided will get you a set of tools that work and play well together. They may not be the most recent versions. Visit the home sites for the latest news and complete documentation.

Caveats

If you've installed Cygwin, you will have some problems that are beyond the scope of this brief introduction. The tools provided by mingw will create conflicts with tools provided by Cygwin.

Packages Reviewed Here

DevC++

A complete GUI development environment. This is the only package you need if you don't want to use command-line tools.
Download installer

MinGW

Command line environment for the GCC compiler, linker, and related tools. The MinGW package is included with the DevC++ package, so you don't need to download this unless you want to work without DevC++.
Download installer

MSYS

Add-ons for MinGW that include Bash, make and other basic Unix/Linux shell commands. By adding this package to DevC++, you can edit, build and maintain programs from the command line window.
Download installer

msysDTK

Add-ons for MSYS including telnet & rlogin.
Download installer

Text file converters

Both DevC++ and MSYS work with Windows or Unix style text files, but it is sometimes nice to convert files for use with less flexible utilities. All the DevC++ header files are, for example, in Unix format.

uf2d and df2u are drag-n-drop Windows programs that convert between Unix and Windows text file formats. They modify the files you drop on them.

Installing DevC++

Just run the installer.
This is the only package you need if you don't want to use any command-line tools.

Installing MSYS

Run the installer listed above.
It will put an MSYS shortcut on the desktop. You have to configure MSYS to work with the GCC tools installed with DevC++:

1) Run MSYS from the desktop shortcut.
2) In the /etc directory you will find an fstab.sample file.
3) Copy this to create a file named simply fstab.
2) Edit fstab to tell msys where you installed devCpp.

MSYS wants the path to MinGW, which in our case is the path to where we installed DevC++. Example fstab entry:

    	    C:/Programs/DevCpp /mingw 

Exit and restart MSYS to use the command line tools. You will have vi, make, grep, diff, etc.

Installing msysDTK

Use the installer listed above.
The msysDTK package has more developer tools including cvs, telnet & rlogin clients. When you run the installer for msysDTK be sure to use the same path you specified when installing MSYS. It goes "on top" of MSYS, mixing in its files and directories. Example:

Path suggested by installer:

	    C:\msys\1.0    NOT THIS 

Path where (I, for example) installed msys:

	    C:\Programs\MinSys 

Using DevC++ make files with MSYS

The makefiles created by devcpp work with make in the MSYS command line environment. By default, the makefile written by devcpp will be called Makefile.win so you need to use:

	    make -f Makefile.win 

Some gcc compiler command-line options

DevC++ has a menu for selecting some optimizations. You can also directly enter gcc command line options. I prefer this method because I use some options not offered by the GUI and I like to see all this stuff in one place.

On processors with big, multi-level caches, some programs run faster with smaller code rather than more optimized code. The following options are not appropriate when debugging:

	    -s                     Strip symbols
	    -fomit-frame-pointer   Don't compile frame pointers
	    -Os                    Optimize for size 

For c++ programs that don't need these features:

	    -fno-exceptions        Don't support exception handling 
	    -fno-rtti              Don't generate run-time type checking 

Linking with library files

Optional Win32 libraries are included using their Microsoft names. On the linker command line, add them with the -l (lower-case L) option. Examples:

	    -lwsock32              Support for sockets
	    -lwinmm                Support for time functions 

Logging into Linux with the msysDTK telnet client

The terminal type reported by the msysDTK telnet client is "msys". Linux will complain that it doesn't know about this terminal type when you log in.

To make the telnet client function as an ansi terminal you will need to add an entry to the terminfo database on the Linux side. Example for Redhat systems:

	    cp /usr/share/terminfo/a/ansi /usr/share/terminfo/m/msys 

Other Linux distributions will probably put the terminfo database somewhere else.

Complaints and suggestions

To Hugh