Sunday, December 28, 2008

Dev-C++

Most of the algorithms I will be discussing will be based on how I will implement them in the C/C++ language. Although algorithms should be purely independent of the programming language used, I often think of the algorithms in terms of the underlying language I would be using to implement them.

In this post, I will be discussing the tool used for compiling the C/C++ codes I create to test my algorithms. Although everyone has his own way of compiling – like others may use g++ or Visual C++ – others may have no idea on how to compile. This post is dedicated to those others who have no idea or are confused on how to compile their codes. I present my way of compiling.

To compile my C/C++ codes, I use the tool Dev-C++. You can use Google to search for it. It’s a tool my teacher from school taught me. I thought I would only use it in school, but when I started working as an employee, I was also using it in the company’s regular programming competitions.

Interestingly, several years since I last used the tool in school, the tool had not changed much. Somehow, someway or another, people just stopped developing the tool, and so no new updates or versions of the tool were released since I last used it in school. And that was several years ago.

Somehow also, it is the only Windows C++ compiler I know how to use until this date. In school, I used to use Borland C++ or Microsoft Visual C++. But somehow, these other tools lost popularity. Borland C++ definitely lost popularity as I don’t hear anybody using it anymore, at least in my neighborhood. Microsoft Visual C++ definitely is ultra popular, but how in the world do you get the software for free. Microsoft keeps collecting money from us, until we third world developers have nothing left to use to develop our ideas and algorithms.

So, I was left with Dev-C++, until now, and who knows, maybe until I’m real old and shriveled like a rotten tomato, still aspiring to be a decent programmer.

Now, going back to the real topic. The Dev-C++ website is kind of confusing. I always got lost in it back in college when I had to download the binary and install it into a workstation. In my days, we had no personal laptops and so we had to hop from one computer to another, and install the bloody tool every time we saw that the workstation we hopped into did not have the tool installed into it.

To download the tool, go to the following website:
http://www.bloodshed.net/devcpp.html

Figure 1 shows a screenshot of the site.


Figure 1. Screenshot of the Dev-C++ website.

Click onto the download page, download the binary and install it. By the way, Dev-C++ is for Windows.

Once installed, you can immediately use it. Figure 2 shows a screenshot of the Dev-C++ tool.

Figure 2. Screenshot of the Dev-C++ tool.

Through the tool, you type in your code, save it and then compile (CTRL-F9). Should there be no compile errors, you can close the dialog box shown in Figure 2. Open a command prompt and run the executable as shown in Figure 3.

Figure 3. Executing the executable.
In Figure 3, go to the directory where you saved your code. More often than not, the executable will be the same name as the file name of your code except for the suffix extension. For example, if you named your code a.cpp, then most likely, an executable named a.exe will be created if your compilation yielded no errors. Simply type the name of the executable to execute.

No comments:

Post a Comment