I have a header file (DataLogger.h) and and implementation file
(DataLogger.cpp) in one project, call it Project1.
From another project, Project2, I used the import wizard to get the
equivalent of a soft link to the DataLogger files.
The result was an entry in the .project file(Project2):
<linkedResources>
<link>
<name>src/DataLogger.cpp</name>
<type>1</type>
<location>/home/rgeddes/Project1/DataLogger.cpp</location>
</link>
<link>
<name>src/DataLogger.h</name>
<type>1</type>
<location>/home/rgeddes/books/Project1/DataLogger.h</location >
</link>
</linkedResources>
I could also see additional resources in Project2 (Project Explorer
View) that looked like project source/header files but with decorations
that looked like arrows (I assume representing links)
I was expecting the preprocessor to see these links as well, but it
balks at:
#include "DataLogger.h" //No such file
I can get through compilation if the path to DataLogger.h is specified:
#include "../Project1/DataLogger.h" //OK
Is there a way to get the preprocessor #include to work with the project
link.
The key thing here to note is that you are creating links via Eclipse and compiling with gcc.
gcc knows nothing about Eclipse so doesn't know about .project files or Eclipse locations. It accesses the file system so as you already know, sym links via the OS work.
What you can do is add your Project1 to the include path for the compilation. You can do this a number of ways depending on what kind of C Project you have.