Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Include another folders into eclipse projects(Add Source Path from other folders (out from Workspace))
Include another folders into eclipse projects [message #1830587] Wed, 29 July 2020 13:02 Go to next message
William Tan is currently offline William TanFriend
Messages: 2
Registered: May 2015
Junior Member
Hi, all.

Currently I have 2 eclipse projects (by simplify I called them Proj-A and Proj-B) and they are both compile/build-able, and both projects are in separate workspaces.

Now, I created a new folder, called Common (out from either workspaces, just a new folder) and there are common.c and common.h

Simple illustration of the folder structure as below

<C>
+---Proj-A (workspace)
|
+---Proj-B (workspace)
|
+--- Common +--- common.c
+--- common.h


Can I know if it possible to include source path/library path (C:\Common) from File System into Proj-A and Proj-B and build?

The idea is Common folder will include all the common files that later being used by Proj-A and Proj-B...

Thanks and regards,
Weelian.

Re: Include another folders into eclipse projects [message #1830620 is a reply to message #1830587] Thu, 30 July 2020 03:18 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
There are a couple of ways to achieve this.

1) link to directory Common in each project

The link can be a system link or an Eclipse simulated link.
The latter is made with File --> New --> Folder
and selecting Link to alternate location under Advanced

Eclipse will then act as if the common code is part of each project.

2) create a common library and link to it in Proj-A and Proj-B

You will need to tell both Proj-A and Proj-B where the common header files are.
This means setting the path to it in Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc.
and, if you are using a managed build,
in the Include settings for each compiler in Project --> Properties --> C/C++Build --> Settings --> Tool Settings tab

Previous Topic:Include indexing not consistent on all cpp files
Next Topic:Is it impossible to install CDT onto Eclipse Java via Marketplace?
Goto Forum:
  


Current Time: Thu Mar 28 10:17:34 GMT 2024

Powered by FUDForum. Page generated in 0.02439 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top