Search this site (www.microchipC.com).





CCS C Compiler for Microchip PIC micros

Your ad here

 

Tutorial for MinGW

This page explains how to install and run MInGW under Windows, in order to complete the programming challenges under UVa Online Judge.

UPDATE: Dev-C++ from http://www.bloodshed.net/ is a viable alternative to this tutorial. Dev-C++ is a full GUI for MinGW.

First, read the UVa tutorial.

Then, to complete the UVa exercises under Windows, follow these instructions:

  • Download and install UltraEdit from www.ultraedit.com.
  • Install MinGW from MinGW sourceforge.
  • Install MinGW, ensuring that C++ is supported.
  • Download ultraedit_make.bat (1KB) and save it into c:\mingw\bin\make_ultraedit.bat.

    ---start c:\mingw\bin\ultraedit_make.bat---
    @echo off
    rem from www.microchipc.com/mingw_tutorial/
    rem Make file for UltraEdit
    rem Companion file for UVa online judge, at:
    rem http://online-judge.uva.es/
    rem First parameter %1 is path, eg: C:\Test\
    rem Second parameter %2 is filename, eg: filename
    rem Third parameter %3 is extension (including dot), eg: .c
    rem Compile the program
    rem You will have to install mingw from www.mingw.com.

    c:\mingw\bin\g++ %1%2%3 -o %1%2.exe

    rem Run the executed program - but only if it compiled.

    if ERRORLEVEL 1 GOTO END
    cd %1

    rem You can see that the input to the compiled program
    rem comes from a file with an extension .txt rather than .c

    %1%2.exe < %1%2.txt
    :END
    ---end file---

  • Install UltraEdit.


  • Select Advanced..Tools..Configuration:


  • Alter the options to point to c:\mingw\bin\ultraedit_make.bat.


  • Alter the output to appear at the base of the UltraEdit screen.


  • Now, we can compile and test a sample program.

    Download 11172.c and 11172.txt. Save them to the same directory.

  • Load up both files into UltraEdit. As you can see, 11172 contains sample input that will be sent into the program via the "cin" statements.


  • Switch to 11172.c, then select "Advanced..Compile and Run". Next:
    (a) The program is compiled to "11172.exe".
    (b) The program is executed.
    (c) "11172.exe" receives input from "11172.txt" via the "cin" statements.
    (c) The output from "11172.exe" is piped back the base of the ultraedit screen.

    You can now upload this program to http://online-judge.uva.es/, to see how it is judged. Find the program 11172, it is located under "Browse Problems :: Contest Volumes :: Volume CXI :: 11172 - Relational Operator".




  • Congratulations. You have uploaded your first program to http://online-judge.uva.es/. You can now hone your program skills by solving other problems. There is over 2,500 problems to complete, and you can see your ranking compared to 80,000 other programmers.
  • To further hone your programming skills, read Springer.Verlag,.Programming.Challenges.(2003).KB.pdf.

 



This site is non-profit. Ad revenue almost covers hosting costs.

We welcome any suggesions or comments! Send them to Shane Tolmie on support@microchipc.com. This site is a completely separate site to www.microchip.com, and is maintained independently of Microchip Ltd., manufacturers of the PIC micro. All code on this site is free for non-commercial use, unless stated otherwise. Commercial use normally free, however, it is prohibited without contacting support@microchipc.com for permission. All content on this site created by Shane Tolmie is copyrighted by Shane Tolmie 1999-2009. Click to advertise on this website - $29.90 for a banner ad which will reach 55,000 user sessions per month. One months free trial!