Visual C++: Adding a New Source (.cpp) File to a Project
Adding a New Source (.cpp) File to a Project
This video shows how to add a source (.cpp) file to an existing Visual C++ project. Assuming that you have a project open, you can follow these instructions:
- To begin, right-click the Source Files folder in the Solution Explorer pane on the left, mouse over Add in the submenu, and left-click New Item.
- This will open the Add New Item dialog. Left-click Visual C++ in the left pane under Installed Templates. The left-click C++ File (.cpp) in the middle pane.
- Below this, left-click the box next to Name: and type "CMyClass.cpp" for a class named CMyClass, and left-click the Add button to go on.
- The source file has now been added to the project and you should see it there. The file is actually located in the your project folder on your hard drive. If you open your project folder, you will see the new file there, as shown below.