Tips for the new C++ programmer
Editing a C++ program
What to save your files as
Where to put your programs
Using a Developer Studio


Tips for the new C++ programmer

Sometimes the most difficult thing about coding is not writing the code correctly, but learning how to use the damn compiler! There are several C++ "Development Studios" available these days. The studios are windows-based environments that can been quite intimidating to the first-time C++ coder. If you are just learing how to write C++, I suggest that you do not use the windows-based environments and focus on some simple code. Once you have some code that you know works, port it over to the studio and try it out there.

Editing a C++ program

If you are working in Windows, I recomend the MSDOS Edit program or Notepad. For more information about DOS Edit, click here. Avoid using WordPad, MSWord, Winword, WordWorks or WordPerfect. All of these programs will add hidden headers, puncuation marks and line-feed marks that may be read by the compiler causing errors. Also, these programs will often autosave as the default files .DOC, .TXT or .WPS. Edit and Notepad give you the flexability to create whatever type of file you want.

If you are using a MAC, I believe there is a MAC version of Notepad. However it has been quite some time since I have used a MAC and I have never used an iMAC(I'd rather choke).

If you are using UNIX/LINUX I recomend the PICO editor. While EMACS is more powerful, I find PICO easier to use. Open your favorite command line shell and type PICO filename, example:
  user$   pico myprogram.cpp 
The great thing about this UNIX command is that it will open the editor and create the file "myprogram.cpp". if you just type "pico" the editor will open a default file that you can name later.

What to save your files as

There are several acceptable file extensions for C++ programs: .c, .cpp, .cc, .cxx, .tli, .h, .hh. Most will work, but .cpp is the most common. When in doubt check the documentation or README.TXT for your compiler. Also, there are usually sample scripts with the development package that will have a similar file extension.

Where to put your programs

Within the directory of your C++ compiler, there should be a sub-directory called "bin." The bin is where your program files should be placed. Example: for MS Visual C++ in Windows the directory will usually be C:\MSDEV\BIN\. Sometimes, development packages will be able to create paths to your code that enable you save scripts outside of the bin. But, for ease of use, at first, use the bin.

Using a Developer Studio

To new programmer a development studio can look pretty intimidating. There are lots of buttons, links and pull-down menus which are all useless. Bells and whistles someone at Microshaft got alot of money for making but don't really help any one. We're concerned with editing, compiling, linking, debugging and executing. We will exploit these aspects of the studio and forget about all the extra crap that adds $ to the price tag of Microshit's high-priced crap. Below is an example of a typical session: