Enter the following simple C source in your new source document (the code deliberately contains a mistake, which you will correct later on):
#include <stdio.h> int main( void ) { printf( "Hello World\n" ) /* <- missing semicolon */ }
Note the following:
The tab label of the editor view shows an asterisk in front of the file name (*myfile.c
) to indicate that the file has been modified.
The C/C++ editor view uses syntax coloring.
The Outline view shows the structure of the file. You can use this view to navigate through (larger) source files easily. Alternatively you can expand the structure of the file in the C/C++ Projects view.
Right-clicking in the editor view presents you with a list of menu commands.
To receive more help about the editor view, make sure it is active and press F1.
To save the file:
From the File menu, select Save (Ctrl+S).
The project will be saved.
To close the file:
From the File menu, select Close Editor (Ctrl+W).
Eclipse will ask you to save the files that have been modified since the last save.
Notice also the menu commands Save All and Close All Editors which you can use when you are working with multiple files.
There are several ways to open an existing file. An easy way to open the C source file myfile.c
directly in the C/C++ editor is:
In the C/C++ Projects view, double-click on the file name.
Eclipse recognizes the file as a C source file and opens the file in the C/C++ editor.
Correct the file by entering the missing semicolon. Save and close the file.
If you want to open a C source file in an application (editor) outside Eclipse (instead of the built-in C/C++ editor), proceed as follows:
In the C/C++ Projects view, right-click on the file myfile.c
and select Open With » System Editor.
The file opens in the application that is associated with the file extension .c
.
Copyright © 2024 TASKING B.V.