I am trying to include and build source files from another project in my Eclipse CDT workspace for an Autotools project. I have tried the steps given in https://stackoverflow.com/a/20792721/4128201 to link the source (.cpp) and header (.h) files and https://stackoverflow.com/a/2305737/4128201 to build the source files in the referencing project by setting up Makefile.am, but I still get build errors related to discovery/linking of the files. For argument's sake I have the following workspace:
projectA/
src/
projectB/
src/
I want to include and build the source in projectB/src from projectA/src, so I have added projectA/src as "projecta" in projectB's
Properties->C/C++ General->Paths and Symbols->Source Location
which results in a new linked source folder in the Eclipse workspace project, ie:
projectA/
src/
projectB/
src/
projecta/ (linked to projectA/src/)
Now I can #include XYZ.h
in projectB's source files and Eclipse finds the links, but when building I get the error:
... fatal error: XYZ.h: No such file or directory
projectA/src is included in Makefile.am
as an AM_CXXFLAGS = -I$(projecta_dir)
include, where projecta_dir
is defined as a project Path Variable in
Properties->Resource->Linked Resources->Path Variables
as an absolute path to projectA/src. So I need to know if it is possible to direct Makefile.am
to parent directories, and also if Symbolic Linked directories in Eclipse are valid for Makefile.am
's accessing?
When rather defining projectA/src as a linked subdirectory in projectB/src to result in:
projectB/
src/
...
projecta/ (linked to projectA/src)
and directing Makefile.am
(in projectB/src) to the subdirectory:
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = projectB
projectB_SOURCES = ... projecta/XYZ.cpp
and including the header #include "projecta/XYZ.h"
I still get the error:
... fatal error: projecta/XYZ.h: No such file or directory
and Eclipse's pop-up error also displays:
Unresolved inclusion: "projecta/XYZ.h"
For reference this is a Yocto Project ADT Autotools C++ Project that implements the GNU Autotools toolchain