Adding a C Source File

After Creating a New Project, you can add source files, then build and run your completed project. Follow these steps to add a hello.c source file to the hello_world project.

  1. Select the hello_world project in the Navigator view.
  2. From the Eclipse* File menu, select New > Source File. Enter hello.c in the Source File text box of the New Source File dialog. Click Finish to add the file to the hello_world project.
  1. Your Eclipse Preference settings in Window > Preferences > General > Workspace let you specify Build automatically. If this preference is checked, Eclipse/CDT will attempt a build when hello.c is created. Since hello.c does not yet include code, errors are indicated in the Problems view near the bottom of the screen. This is expected behavior, not a true error.
  1. In the Editor view, add your code for hello.c.

When your code is complete, save your file using File > Save, then proceed to Building a Project.