0% found this document useful (0 votes)
12 views

Practical 00

The document provides instructions for creating and running a basic C++ project in Visual Studio. It describes how to start Visual Studio, create an empty project called Practical1, set the subsystem to console, add source files for two programs (q1.cpp and q2.cpp), compile and run the first program, then exclude q1.cpp from the build and run the second program instead.

Uploaded by

Jasper Lim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Practical 00

The document provides instructions for creating and running a basic C++ project in Visual Studio. It describes how to start Visual Studio, create an empty project called Practical1, set the subsystem to console, add source files for two programs (q1.cpp and q2.cpp), compile and run the first program, then exclude q1.cpp from the build and run the second program instead.

Uploaded by

Jasper Lim
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Practical Appendix

1. Start Visual Studio:


1. Click Start→All Programs→Microsoft Visual Studio 201X→Microsoft Visual Studio 201X

2. Create a new project:


1. Select File→New→Project
2. Choose Visual C++→General for installed templates
3. Select Empty Project
4. Type in Practical1 for the name
5. Click Browse and choose Desktop.

1
3. Right-click on the Project name in the Solution Explorer window. Select Properties.
Solution Explorer window

Project name

4. The Properties dialog window opens. Select Configuration Properties→Linker→System.

5. For SubSystem, choose Console (/SUBSYSTEM:CONSOLE).


6. Create a new program file (q1.cpp):

2
1. Right-click Source Files folder in the Solution Explorer
2. Select Add→New Item
3. Select C++ File (.cpp)
4. Type in q1 for the name.

3
7. Type the program code into the Code Editor window.

Code Editor window

8. Compile the program:


1. Select Build→Compile or press Ctrl+F7
2. Make sure there are no error messages
3. Ignore any warnings

9. Execute/run the program:


1. Select Start→Start Without Debugging or press Ctrl+F5
2. When the message “This project is out of date: Would you like to build it?” appears, click Yes.

10. Create another program file (q2.cpp):


1. Right-click Source Files folder in the Solution Explorer
2. Select Add→New Item
3. Select C++ File (.cpp)
4. Type in q2.cpp for the name.

11. Run the second program:

4
1. In the Solution Explorer window, right-click the program file q1.cpp and select Properties.
2. In the Property Pages dialog window, change “Excluded From Build” to “Yes”.

3. The file q1.cpp is now excluded from the Build / Compilation process. You can now run q2.cpp.

q1.cpp is
excluded
from Build

You might also like