Você está na página 1de 21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Microsoft Visual C++ 2008 Express Edition Tutorial


First, download the windows installer from Microsoft/Express and then, run the executable. Follow the instructions and install the program. The following screenshots will help you install the product:
Welcome Screen Click the Next button to continue

License Terms Select the "I have read and accept the license terms" option and then, click the Next button to continue

Destionation Folder Click the Install button to start the installation

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

1/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Download and Install Wait for the download and install operations to finish

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

2/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Setup Complete Click the Exit button to finalize the installation

You can choose to use the command line tools or the graphical user interface to write your programs. To use the command line tools, check this page on MSDN. If you would like to use command line tools, we recommend Notepad++ as an editor. It has syntax high-lighting capability, which is very helpful for developers. If you do not prefer to use command line tools, you can run the Visual Studio IDE by following these instructions: Goto Start -> All Programs -> Microsoft Visual C++ 2008 Express Edition -> Microsoft Visual C++ 2008 Express Edition to run the program. After the program launches, follow the steps depicted in the below screenshots:
Start Page You should see a page similar to this after you run the program

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

3/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

File Menu Click on the File menu, select New menu item and click on the Project menu item to create a new project

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

4/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

New Project On the left, choose Win32 under Project types -> Visual C++ And, on the right, choose, "Win32 Console Application" under Templates Give a name to your project, for instance, "HelloWorld" and click OK to create your project

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

5/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Win32 Application Wizard - Welcome Click the Next button to continue

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

6/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Win32 Application Wizard - Application Settings Make sure "Console Application" and "Empty Project" options are selected Click the Finish button to finalize

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

7/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Add New Item Menu Right click on the name of the project, for this case, it is "HelloWorld", and select Add menu Then, click on the New Item menu

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

8/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Add New Item On the left, choose Code under Categories -> Visual C++ And, on the right, choose, "C++ File (.cpp)" under Templates Give a name to your file, for instance, "hello.c" and click the Add button to create your file

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

9/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Hello World Now, you can write your code using the editor Write a simple C program as given in the screenshot

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

10/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Build Menu Click on the Build Solution menu item under the Build menu or just press F7 You should be able to see the progress on the Output window below

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

11/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Build Successful Assuming you did not make any typing errors on the previous step, you should see a similar output on the Output window

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

12/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Compile failed If you try to compile a code which has syntax errors, Output window gives a message similar to this: "0 succeeded, 1 failed..." In addition, you should be able to see the problems from the Error List Window, which can be opened from View Menu. Select Other Window sub-menu and click on the Error Lis menu item.

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

13/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Compile Errors You can see the errors in the code in the Error list window

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

14/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Compile Warnings You can also see the warnings in the Error list window

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

15/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Running You can run your program from the Debug menu. Click on the "Start Without Debugging" menu item or press Ctrl+F5

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

16/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Run Output After clicking on the "Start Without Debugging" menu item, you should see your program run in a separate window.

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

17/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Above steps are the necessary steps in order to compile and run C/C++ programs with Microsoft Visual C++. However, since C++ is a super-set of C, Visual C++ compiles your code as a C++ code. Therefore, you should make sure that your code is a valid C code. If you prefer to use command line tools, check this page to compile your code according to ANSI C standards. Otherwise, Visual C++ compiler settings can be configured by following the below two steps:
Project Properties Menu Right click on the name of the project, for this case, it is "HelloWorld", and click the Properties menu item

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

18/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Property Pages On the left, select Language under C/C++ under "Configuration Properties" On the right, select "Yes (/Za)" for "Disable Language Extensions" Click the Apply button

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

19/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

Property Pages On the left, select Advanced under C/C++ under "Configuration Properties" On the right, select "Compile as C Code (/TC)" for "Compile As" Click the OK button to finish

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

20/21

24/04/13

Microsoft Visual C++ 2008 Express Edition Tutorial

ceng230.ceng.metu.edu.tr/Compilers/ms-cpp.html

21/21

Você também pode gostar