Friday, October 17, 2008

Parking Lot

  • A comment that begins with /* always ends with the next */. As a result, one comment pair cannot occur within another.
  • Headers for the standard library are enclosed in angle brackets (< >). Nonstandard headers are enclosed in double quotes (" "). eg: #include<> #include"SaleItem.h".

  • We can declare a name without defining it by using the extern keyword. A declaration that is not also a definition consists of the object's name and its type preceded by the keyword extern:

          extern int i;   // declares but does not define i
    int i; // declares and defines i
  • extern double pi = 3.1416; // definition
  • constvariables are local to a file by default. To make a const variable accessible to other files we must explicitly specify that it is extern.
  • By default, the access level in C++ in classes is Private.
  • Header files are for Declarations, Not Definitions.
  • It might be logical to expect that size returns an int or an unsigned. Instead, the size operation returns a value of type string::size_type.

Thursday, October 16, 2008

How to build and execute any dumb C++ program on VS2008

One of the most common initial errors which the newbies to Visual Studio encounter
ERROR::::: general error c1010070: Failed to load and parse the manifest.

Follow the steps below to workaround your first roadblock in compiling C++ programs in Visual Studio 2005/2008.

1. Click File>New>Project
2. Select Other Languages>Visual C++ > Win32 in the left pane. Select Win32 Console Application in the right pane.
3. Name the project and click Ok.
4. In the next Pop-up, Click on Application Settings.
5. Click Project>Add Existing Item.
6. Select a checkbox for "Empty Project".
7. Click Finish.
8. In the Solution Explorer, under Source files, Right click and select Add Item.
6. Select a .cpp file
7. Name the file and press Ok/finish.
8. Add your code.
9. Build your Solution(F6)
10. Execute it (F5)

You should be good to go with that.

Tip>> Always avoid having names of projects or cpp files as Example1.1 and so on as VS 2005/2008 do not tend to like the "." in between the names.