Newbie: Where to start

Hi all.
just starting to learn c++ as a result of the assignment my younger sister game me to do for her and i was not really happy i couldn't. I have a knowledge of PHP.
In PHP i know you need a server to view your development and notepad/dreamweaver etc to write codes.

my question might appear dumb, but then its better to be prune to grow than cut to be burnt.
My question is what are the tools one needs in order to write programs in c++?
IDE, Compiler etc and where i can lay my hands on these tools (the free stuff first)

Thank you
You really only need a compiler, though an IDE is preferred if you don't have experience with makefiles and things like that. Some good IDE's that are around (I recommend the first):

Code::Blocks - http://www.codeblocks.org/downloads/26
NetBeans IDE (with the C++ module) - http://netbeans.org/downloads/index.html
Eclipse - http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers-includes-incubating-components/indigosr2
Microsoft C++ Express Edition

As for your compiler: some IDE's might come with one, others might not. In any case, I strongly recommend the GCC / G++ compiler. ( http://gcc.gnu.org/ )
Last edited on
My question is what are the tools one needs in order to write programs in c++?


You write C++ code in plain text files. These files are then fed to a compiler.

The compiler takes each file individually and the following things happen:
- Any lines of the form #include <someFile> have the file someFile pasted into that spot.
- The compiler then starts at the top and compiles the text file into an object file. Any function calls to functions that are not defined in that single file have a note left to the linker asking it to find that function and link it properly.

The linker is then given a list of all the object files to link. If you are making an executable, one of these object files must contain the main()function. If you are making a library, this is not necessary. The linker goes through each object file, ensuring that every function call is properly linked to the actual object code of that function. Some of these will be functions you wrote. Some will be functions in libraries you are using. Somewhere will be the function (provided by the writer of the linker/compiler and specific to your operating system and architecture) that sets things up and actually calls main() when you run the executable; this set of cleverness is generally referred to as the runtime library ( http://en.wikipedia.org/wiki/Runtime_library ) and it handles the platform specific things for you so that you don't need to.

The linker gives back the executable or library.


So, to code some C++, you need:

A text editor.
A compiler.
A linker.

Commonly, the compiler and linker are provided together, and usually are wrapped into some convenient method of chaining them together so that you don't need to run them separately yourself. You can do, though, and even if you never do, knowing what they actually do will be a big help when you have to deal with your own programming errors (the number of times you see people trying to fix a linker error by altering unrelated code going into the compiler is depressing).

Your choice of compiler/linker is often related to your operating system and/or IDE of choice (note that an IDE is by no means necessary - text editor, compiler, linker is what's needed).

The GCC (GNU Compiler Collection) is well-regarded. The young upstart LLVM (with clang front-end) has fantastic diagnostic messages. There are many more options.


Last edited on
thanks kyon and moschops.
trying to download codeblock but my network seems slow. will download it later.
in the course of my search, i came across dev-c++, is it good enough for a newbie? cos i tried executing/running the "hello world" but saw no screen/output for result

thanks
i came across dev-c++, is it good enough for a newbie?


NNNNNNNNNOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!

Never use Dev-C++. It's not up to date with standards, it's got lots of bugs, and it's long since been abandoned by it's developers.
If you are a Windows user try either Microsoft C++ Express Edition or Eclipse, forget about other :-)

If you are a Unix user, than no need for IDE :-)

therockon7throw, Moschops, kyon, ciphermagi. Thanks all. I will give Microsoft visual c++ a short but for now I have downloaded codeblock and it seems it needs knowing how before using it. I have sort for tutorials on how to use it but haven't found yet. I tried some codes I copied from cplusplus forums and its giving me errors so I came to conclusion that I need to learn to use it first. Is there any link to codeblock tutorial?
Thanks all once again as I look forward to learning and helping others too.
Exactly what errors is it giving? Code::Blocks is really straightforward once setup correctly (like any IDE).

Microsoft C++ Express Edition is good too, but I really only added in the list I gave earlier for the sake of completeness. I would not recommend it as it allows for non-standard code to run and has given me some trouble in the past.
Probably the setup is missing.
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler

In PHP i know you need a server to view your development
Here, you execute programs.
If you are doing a 'console' program then I suggest you to execute the program from a console.
Topic archived. No new replies allowed.