Working in Visual C++ continued:

Type the code in the editor window and save the source file as below.

To compile the code, go to the option BUILD->Compile first.cpp.

The result of compilation will appear in the window at the bottom of the screen. There should be no errors to continue further.

Next go to BUILD->build hello.exe.

This invokes the linker which will create the executable file called hello.exe. Again the messages produced by the linker appear in the window below the editor.

 

If linking is successful then we can run the code through VC++ itself. Just go to BUILD->Execute hello.exe option.

In older VC++ versions when creating a new C++ source file, it may not get included into the current project. To include a file into the project, go to PROJECT->Project Settings and insert the file into the project. If you want to exclude a file from the project, then in project settings check the option “Exclude file from build” (shown in figure below).

Assembly listing:

If you are curious to see the assembly level code, in the project settings click on the tab titled C/C++. Choose the category “listing files” and choose what output listing you would like to see (there are choices like: machine code, assembly code, assembly code with the source code etc). Now when the file is compiled you will find another file containing the type of listing you chose.

 

Go back to Contents Page 2

Copyright © 2005 Sethu Subramanian All rights reserved.  Sign my guestbook.