Friday, March 26, 2010

gcc in windows (test on xp)













Warning: this is not for NooBs
Do this at your own risk.

get gcc for windows
http://gcc.gnu.org/install/binaries.html

download and install

Microsoft Windows:

* The Cygwin project;
* The MinGW project.

set the path in environmental variables:
;C:\MinGW\bin;

put c code in a folder
c:\mkdir ccode
// put this code in that folder

<> >gcc on windows (tested on windows xp)
pu c code in this folder
c:\mkdir ccode
// put this code in that folder
//start of hello world "hello.c"

#include <stdio.h>
int main (void)
{
printf ("Hello, world!\n");
return 0;
}
// end of code hello.c


to compile:
cd c:\ccode\
c:\gcc hello.c -o hello
to run
c:\hello


// here's some simple math code
//program1.c

#include <stdio.h>
#include <math.h>

int main(void)
{
printf("%.0f\n", sqrt(4));

return 0;
}
//make sure to add a new line at the end

1 comment:

  1. Hey Mr. Coleman,

    I got the steps you posted done and completed but i've been having a bit of a hard time getting hold of the "for loop", "while loop", and "Do-while loop" codes. I've done a lot of searching for quite a few hours with not too much luck in a working code. could you give me a bit of advice to help out? i'm going to be making the website after all of this for the senior project too. thanks for the help.

    Sincerely,

    Trevor Goody

    ReplyDelete