Tuesday, July 14, 2009

How do you set up the C compiler?

Hi all. I just downloaded a C compiler called MinGW. I've installed it and now I'm not sure of what to do? Can someone pls help me with step by step instructions? I'm using XP btw...Thanks!

How do you set up the C compiler?
Create a c program in your favorite text editor something like this:





#include %26lt;stdio.h%26gt;


int main(int argc, char** argv) {


printf("Hello, World\n");


return 0;


}





Save this to a file such as main.c





then to compile the file type: C:\MinGW\bin\gcc -c main.c


this will generate a main.o file. Object file.





then link the object file to create an executable like this:


C:\MinGW\bin\gcc -o main.exe main.o





and you there you have it a main.exe





more info here http://www.mingw.org/docs.shtml#compilin...
Reply:Sorry to hear you are using XP. Install LINUX (SUSE UBANTU) and you will not only have some excellent secure, opensource tools, you will also have many examples of C code to examine.
Reply:Here you go:


http://www.bloodshed.net/devcpp.html





This uses MingW I believe except it had an IDE front end. When I used to program in C / C++ This is what I used in windows.


No comments:

Post a Comment