anr78
anr78

Reputation: 1318

Importing list of source files into an Eclipse project

We have a topdirectory containing code for lots of different projects. I would like to create an Eclipse CDT-project that contains only the source needed to work on and compile a specific project. I used SlickEdit before, and there I could just import a list of sources and headers. Is it possible to achieve something similar in Eclipse?

Upvotes: 5

Views: 3791

Answers (4)

knb
knb

Reputation: 9295

In Eclipse Helios (3.6)

In eclipse project, righ-mouse-click "New ..." > "Folder".

A dialog box appears.

Click "Advanced" button...

Click "Link to alternate Location" radio button.

Click "Browse"

Select the folder you want to link to.

For a refinement , see "Help" > "Help Contents" (a new window appears)

"Workbench User Guide" > "What's New"

Search for "Virtual folders"

Upvotes: 0

Yoni
Yoni

Reputation: 10321

In Eclipse, you can selectively import certain directories to be included in the project.

You can create an eclipse project somewhere else in your drive, and then create links only to the folders that you want in your original location (these are called "linked resources" in Eclipse)

You can also use the linked resource strategy for an entire project (I mean an Eclipse project, not your top-level project). For example, if your folder hierarchy is as follows:

/top-level
/top-level/projectA
/top-level/projectA/subProjectA
/top-level/projectB

You can create an eclipse workspace at location /my-workspace, create a project called subProjectA and have it linked to /top-level/projectA/subProjectA. You can do the same for projectB and they will appear in your Eclipse workspace as if they are side-by-side in a flat hierarchy.

Upvotes: 1

JesperE
JesperE

Reputation: 64404

Traditionally, Eclipse assumes that the .project file is at the top-level directory of your project's sources and all the source code below it is included in the project. However, I think that you should be able to use linked folders so that you have a Eclipse project directory which is basically empty but for a .project file and a linked folder which points to your source tree. I do not think however that you can explicitly list the files to include in the project.

EDIT: if you do find a solution to this, please let me know.

Upvotes: 0

Sam Liao
Sam Liao

Reputation: 46043

So far as I know, you can not do that. What you can do is import these source files into another project, which means these file will be copied to that created project.

Upvotes: 0

Related Questions