Creating Source Files

The next step is to create source files for the scanner_test project.

  1. Start by selecting the scanner_test project in the C/C++ Projects view and right-click to open the context menu.
  2. From the context menu select New > Source File. Enter the file name scanner_test.c and leave the parent folder as the project folder (scanner_test).
  3. Click Finish.

The editor view should open scanner_test.c. Enter this program:

#include <stdio.h>

#include "scanner_test.h"

int main(void){

    printf("Hello from scanner_test.\n");

    scanner_test_func();

    return(0);

}

void scanner_test_func(){

     printf("Hello from scanner_test_func.\n");

     return;

}

Be sure to save the file when you are done editing.

Now we want to create a new folder under the project folder for the project's include files.

  1. Select the scanner_test project in the C/C++ Projects view and right-click to open the context menu.
  2. From the context menu select New > Folder. Enter the Folder name scanner_test_includes. The parent folder should be the project folder (scanner_test). Click Finish.
  3. Next select the new scanner_test_includes folder you just created in the C/C++ Projects view and use the context menu to create a New > Header File named scanner_test.h with this new folder as the parent  (scanner_test/scanner_test_includes).
  4. Finally, use the editor to enter the following code for scanner_test.h:

#ifndef SCANNER_TEST_H

#define SCANNER_TEST_H 1

void scanner_test_func();

#endif