I'm new to this, and I have a question.

I've only ever written some basic flash coding and have been looking into C++ with a huge interest. I will soon be starting college in game and simulation programming.

Alright, now for the question. I beg you to not poke fun at me, for this may seem like common knowledge to most of you. I'd also like to let everyone know I've done a great deal of searching and googling to answer this myself.

Where do I write the code? I understand I could write it anywhere really, but what can I do to activate it and see it work. I understand the "hello world" code, but I am clueless as to how to see it in action. When programming in flash I would write code in the actions and then file play.

I apologize for asking something so simple, but out of all the beginner tutorials I cannot find anything to explain this to me.

Please help, and thank you.
-Flinch
Last edited on
You write the code into .cpp files. Then you need a compiler to translate it into executable code for you platform.
For Linux, the compiler of choice is g++. I don't know which (free?) compilers are best for Windows, though.
^Possibly dev-c++
+1 for Dev-C++

Definitely a good development environment for a newbie.
what do the not so newby people use?
I'd hope the same, otherwise it is not suitable for beginners either. The question should not be "new", it should perhaps be "professional" as in "expensive". Of course, it *might* be (I've never tested that) that the intel compiler produces the best code for intel CPUs. But that doesn't mean that it is really "better", in terms of stardard compatibility, readability of error messages etc., and you perhaps can't use it to develop for ARM, SPARC etc., where g++ is available already.
yea because it sounds as if theres better things out there to use, that are harder to use (hence not 'suitable' for newbies'). i rather just use what everyone uses and familiarize myself with that
Here's a (very) short analysis of the most common compilers/IDEs to help on the decision of which to choose: http://www.cplusplus.com/forum/windows/3622/

IMO, the best environment for a newbie is a good text editor (I like Notepad++. The least a text editor needs to be considered "good" is syntax highlight) and a command line compiler like g++.
IDEs tend to create bad habits, like dependence on word completion and the debugger. A programming newbie should first learn to do the debugging in his head. When that fails, then can the debugger be used.
Argh =\

IMO, the best environment for a newbie is a good text editor (I like Notepad++. The least a text editor needs to be considered "good" is syntax highlight) and a command line compiler like g++.


That'd be the worse imo.

IDEs tend to create bad habits,


IDE's tend to create GOOD habits.

like dependence on word completion and the debugger.

Word Completion = Faster development time, less spelling mistakes and compiler errors. These show up with sufficient syntax highlighting and hover-lookups.

Debugger = Allows you to profile/watch variables for changes, track memory allocations and deallocations and debug buggy code/runtime errors.

A programming newbie should first learn to do the debugging in his head.


People ate terrible at debugging code in their head. Any sufficiently sized piece of code should be run through a debugger if you are having issues with it. OR alternatively, have coded in debug information.

When that fails, then can the debugger be used.


Save yourself time, headache and un-necessary mistakes. Use an IDE.


Where do I write the code? I understand I could write it anywhere really, but what can I do to activate it and see it work. I understand the "hello world" code, but I am clueless as to how to see it in action. When programming in flash I would write code in the actions and then file play.


All code is written in .cc or .cpp files for standard implementation. (.h / .hpp files are used for header declarations). Once the files have been developed they are compiled and linked into an executable by your compiler. From here you are free to the run the executable.

Typically, most developers will use an IDE (Integrated Development Environment). This provides you with the text editing, compiling, running and debugging functionality you need to make applications from scratch. IDE's also offer extended functionality like syntax highlighting, function and variable lookups, code-completion etc.

There are many different IDEs, some are suitable and aimed towards new developers, others are aimed squarely for the professional market.

Dev-C++ from http://www.bloodshed.net/devcpp.html is a very suitable IDE for a new developer. It should see you right quite comfortably even into a professional career.

Other popular ones are Code::Blocks (Multi-Platform), Anjuta (Linux equal of Dev-C++), Eclipse, Microsoft Visual Studio (C++/Windows).

Compiler you use doesn't make much difference. It's usually what your IDE comes with, or works best with.

Dev-C++ will come with the MingW Compiler. This is the Windows port of g++.
Last edited on
Word Completion = Faster development time, less spelling mistakes and compiler errors. These show up with sufficient syntax highlighting and hover-lookups.

Debugger = Allows you to profile/watch variables for changes, track memory allocations and deallocations and debug buggy code/runtime errors.

Yes, both are great features. The problem is not using them, but becoming dependent on them.
People ate terrible at debugging code in their head.

They won't get any better if they just depend on the debugger to do the job for them.

And there's no such thing as an unnecessary mistake, when it comes to learning.
Nothing wrong with being dependent on World-Completion. It saves you typing long class/variable/method names continiously.

IMO, it's better to rely on a debugger and actually know how to use it properly than to not-rely on it and only have sub-par knowledge. Too few people know how to correctly use a debugger. I'd like to see more people relying on the use of a debugger personally.

unnecessary mistake, when it comes to learning.


Declaring "minimizer" and then everywhere typing "minimiser" because you didn't have word completion. You've learnt (but should already know) USA vs UK spelling sucks. Word-Completion ftw.
There is something wrong: one day, you may come across an environment where you don't have one of the two, and then you're screwed. I know. It's happened to me before. I had to use a text editor to modify my source, but I didn't remember the structures I myself had designed, mainly because, having become accustomed to IntelliSense, I lost the habit (whether this was for the better or for the worse is a matter of opinion) of using short, easily remembered and typed acronyms as identifiers (e.g. gml() instead of getMemoryLocation()). I couldn't remember what anything was called.
It could be argued, though, that it's not word completion that sucks, but not having it. That would probably be an accurate assessment.
Last edited on

Without getting into the IDE Vs text editor debate,

It comes down to what you want. Using text editors teach you about using the compiler as well as learning the code, using an Integrated Development Environment (IDE) takes knowledge of using the compiler out of the equation and allows you to learn the code without needing to know how to use the compiler as the IDE manipulates the compiler for you.

There are normally two file types involved with C++; header files and source files. Header files normally have a .h extension and source files can have one of a number of extensions .cpp, .cc, .C, .cxx etc but they are all just normal flat text files following that naming convention. These file extensions are used because the IDE's and compilers know to look for them.

In simple terms......
The compiler takes each source file and generates what is usually referred to as object code, by convention a file usually with a .o file extension. If there are multiple souce files there will be an object file corresponding to each source file. Header files are not compiled but merged in with source files by the compiler as part of the compilation process.

Once the object code has been produced, the linker merges the object files and creates the executable program. If there is only one source file, the compiler just creates the executable without having to merge. Quite often the compiler and the linker are the same program just given different commands.
Last edited on
i guess i should "help" you two out of the hole...

i am "relatively" new to programming... and i started with the gcc 2.95... a command line compiler - as you should know , maybe^^ -

like learning a normal language, learning a programming language is all about:

1.The Vocabulary AND
2. Learn The GRAMMAR/Synthax AND

point 1 is the basis... if u dont know anything u cant start anything... easy, huh?...
with the second one there arrives the understanding of how things work etc...

It is way easier to remember something, when u already written it out instead of being helped by an intelli-sense^^...

know-it-all xD...

greetz...
Topic archived. No new replies allowed.