SRL Archive - C/C++ Help and Tutorials

C++ Compiler Tutorial


Dusk412

2008-07-09 14:40:49

C++ Compilers Tutorial

Description:
This tutorial will teach you all you need to know about C++ compilers.

Table of Contents:
I: Introduction
II: Compilers

I. Introduction:
A compiler is a program that allows you to turn your source code, which is all the words that you will write, into an executable file, which is a program that will actually carry out your instructions. This is probably the first thing you will need when learning to program in C++. There are hundreds of compilers across the internet, some you must buy, others are free.

II. Compilers:
Here is a list of compilers by system I stole from http://www.cprogramming.com/compilers.html .

Windows/DOS
- Code::Blocks and MINGW Our recommended free compiler setup!
- Borland Find out how to download and set up Borland's free command-line compiler
- DJGPP Read about DJGPP, a DOS-based compiler
- Dev-C++ and Digital Mars Read about Dev-C++, a good windows based compiler, and Digital Mars

Windows Only
- Microsoft Visual C++ Read about Visual C++

*nix (like Linux or Unix perhaps)
- g++ is a C++ compiler that comes with most *nix distributions.

Macintosh
- Apple's own Macintosh Programmer's Workshop is a compiler I've never used, but it is direct from apple and free.
- Codewarrior My experiences with Codewarrior are limited to Java programming, though it's gotten good reviews in the past. It's a full IDE rather than just a compiler, meaning that it has a text editor and debugger integrated with the compiler so you can do all your work from one place.

Other C++ Tutorials:

C++ Compiler Tutorial:
http://www.villavu.com/forum/showthread.php?t=32498?p=428885#post428885

C++ Variable Tutorial:
http://www.villavu.com/forum/showthread.php?t=32499?p=428888#post428888

C++ Constant Tutorial:
http://www.villavu.com/forum/showthread.php?t=32500?p=428889#post428889

C++ Operator Tutorial:
http://www.villavu.com/forum/showthread.php?t=32501?p=428891#post428891

Wizzup?

2008-07-09 14:54:04

Cool. Four new tutorials for readers to digest. Keep it up!

Dusk412

2008-07-09 15:08:08

Thanks Wizzup?.

boberman

2008-07-09 18:24:59

A common misconception that is being perpetuated by this thread. I can't say it enough AN IDE IS NOT A COMPILER. Dev-C++ is not a compiler, Code::Blocks is not a compiler, Visual C++ is not a compiler (well, kind of. The actual compiler falls under the same name). They are all IDEs.

MingW is a compiler set based on gcc. Most free compilers and development tools are based on gcc. And this is important to realize, it isn't just a nit-pick. I can write code in notepad, vim, emac, wordpad ect. But until I run it through a really complier it is nothing. As far as I know, there are no compilers with gui interfaces, they are all commandline.

The reason this is important is because you can often have bugs with an IDE but not a compiler or visa-versa. The IDE is a tool, nothing more, it does not compiler you program for you, only makes a nice project (some of them).

A great example of an IDE without a compiler would be Ajunta.

R0b0t1

2008-07-09 19:38:15

Code::Blocks is also for Linux/MacOS.


But if you're using OS X, please, use Xcode. It owns.

Yakman

2008-07-10 13:59:53

perhaps you could write about the difference between a preprocessor, compiler, assembler and linker?

since when people say "I will compile my code" they normally mean they'll do all of the above, and you can do each one separately if you want, which is useful in some situations

Smartzkid

2008-07-13 23:39:06

Netbeans is a pretty nice C++ IDE aswell.

BenLand100

2008-07-14 10:03:27

From: Yakman
perhaps you could write about the difference between a preprocessor, compiler, assembler and linker?

since when people say "I will compile my code" they normally mean they'll do all of the above, and you can do each one separately if you want, which is useful in some situations


Many "compilers" gloss over the differences between compiling and assembling, if they make any distinctions at all. Sometimes compiling is referred to simply as parsing (to a parse tree). In addition, most people stop before the linking stage and link all object files later, but thats just preference. GCC is not helpful at pointing out these differences because it is standard to invoke all stages from the same executable (g++) although ld is the linker, and as is an "assembler"…

R0b0t1

2008-07-30 04:38:03

They should have named it 'ass'. :(