Книга: Embedded Linux development using Eclipse

4.2 Creating a New Project

4.2 Creating a New Project

For this exercise we’ll create a fairly straightforward record sorting application. The records to be sorted consist of a name and an ID number. To simplify the code a bit, we’ll replace any spaces in the name field with underscores. The program will sort a file of records in ascending order, either by name or ID number, as specified on the command line thusly:

record_sort <datafile> [1 | 2]

Where “1” means sort by name and “2” means sort by ID. Sort by name is the default if no sorting argument is given.

In the Eclipse C/C++ perspective, create a new C Project and call it “record_sort.” The project type is Executable and we’ll use the default workspace location. Clicking Next brings up the Select Configurations dialog where you can select either or both of the Debug and Release configurations. Later you’ll have the choice of building either of these configurations. The primary difference between them is that the Debug configuration is built with the compiler’s debug flag, “-g”, turned on to provide information to GDB. The Release configuration leaves out the debug flag.

There’s also an Advanced settings… button to delve deeper into project configuration. We’ll look at that later.

When you click Finish in the New Project Wizard, the workbench looks like Figure 4.1. The only item under the record_sort project in the Project Explorer view is Includes, which is a list of paths to search for header files. Eclipse attempted to build the project, but of course there’s nothing to build since there are no source files.


Figure 4.1: Empty project.

At this point it would be useful to take a look at the directory workspace/record_sort/. It contains just two files, .cproject and .project, both of which are XML code describing the project. The .project file provides configuration information to the base Eclipse platform while the more extensive .cproject file provides information to CDT. It’s not necessary to understand the contents of these files, but it is useful to know they exist.

Оглавление книги


Генерация: 0.068. Запросов К БД/Cache: 0 / 4
поделиться
Вверх Вниз