Creating a C or C++ source file

Once you have created a new remote C/C++ project, you can begin populating it with your source code. The following section describes how to create a .c or .cpp file and save it in the remote project that you created. It also describes how to import existing files from your local file system.

Creating a C or C++ File

To create a C or C++ file:

  1. In the Project Explorer view, right-click your remote project, and select New > Source File.

  2. New > Source File from the Project Explorer

  3. Using the pulldown on the Template field, select either the C or C++ template.

  4. Template Field of the New Source File Wizard

  5. In the Source File field, type the name of the file to be created including the appropriate extension.

  6. Source File Field of the New Source File Wizard

  7. Click Finish. The file will automatically open in the Remote C/C++ editor.

  8. Editor view with a newly created file

  9. Enter your code in the editor and save the file.

Your new source file is displayed in the Project Explorer view. Before you can build your remote C/C++ project, you must create a makefile. See Creating a makefile.

Importing an existing C or C++ file from your local file system

To import an existing C or C++ file from your local file system:

  1. In the Project Explorer view, right-click your remote project, and select Import.

  2. File Import from the Project Explorer

  3. Select General > File System.

  4. File Import from the General File System

  5. Click Next.
  6. Locate and select your C or C++ source file(s) and click Finish.

Your new source file is displayed in the Project Explorer view. Before you can build your remote C/C++ project, you must create a makefile. See Creating a makefile.



Related tasks
Create remote connection
Create a Local/Remote C/C++ Project
Creating a makefile
Building a C/C++ project
Editing a C or C++ file