Friday, July 31, 2009

How do you use a compiler?

Ok im in the process of learning C++ and i was wondering how to use a compiler. I got this book C++ withought fear and it came with a compiler and its really crappy becuase i cant even get it too work on my windows xp.





So i downloaded dev-C++ and i dont quite get it i mean the thing looks like windows dos computers. Black screen with letters on it. I thought C++ was the high tech stuff they use for making world of warcraft and any other game out there thats 3-d and such.





WEll back to my question i dont quite get how the whole thing works about compiling can anyone plz help me!!!

How do you use a compiler?
A compiler (you may know) is the program that translates your C++ code into the language of ones and zeros that the computer understands. As such, it does not have to look spiffy. Ugly is okay.





There are some differences among compilers as to exactly how you use them, but the general idea goes like this. You write your C++ program in an editor and save it to disk. You tell the compiler where to find the program and it reads it and tries to translate it into machine language. It fails because no one can write a perfect program the first time. It gives you a list of errors it found. You patiently go through the list and correct the errors as best you can, then try to compile the program again. You keep repeating editing (debugging) and compiling until the program compiles. Then, you find out that it doesn't do what you meant for it to do. That is because there are still errors in the program. You find the errors, correct them, and compile again. You keep doing this over and over, and eventually, the program works the way you want it.





Your first programs should be very, very, very simple. I hope your book guides you in this direction. The first program should do something like print "hello." Once you get to that point you can enhance it. It might ask you to input something, then output that. You keep making more and more complicated programs, and eventually, you'll be able to program interesting stuff.





Good luck!!





=====================





I searched google for open source compilers and the two that came out on top are linked below. Maybe you would like one of those better.
Reply:When I had (note the past tense) to write C++ code, I used Borland C++, it's not free but it includes an excellent GUI compiler and debugging utility. I don't know of anything free that comes close.





http://www.borland.com/downloads/downloa...
Reply:download .net SDK from microsoft 's website and use it to compile your program from MS-DOS. can't get easy than this.


No comments:

Post a Comment