Getting Eclipse CDT to use relative include paths in generated Makefiles
Solution 1
If you use relative path in the 'include paths' (instead of ${workspace_loc}
), then the makefile (and .mk files it uses) will include relative paths as well.
Solution 2
The relative paths you add in "Project > Properties > C/C++ General > Paths and Symbols > Includes" tab are relative to your project folder.
The ones that appear in the generated makefiles are relative to the main Makefile location.
Related videos on Youtube
Nikratio
Updated on May 06, 2022Comments
-
Nikratio about 2 years
I am using the Eclipse CDT. I have configured the "external Builder" and I am generating the Makefiles automatically. Unfortunately, the generated Makefiles contain the absolute include path. I would like to use the generated Makefiles on other systems (where Eclipse is not installed) - is there a way to make Eclipse use relative paths into the Makefile?
I have configured my projects include directory under Settings -> Tool Settings -> GCC C Compiler -> Include Paths using ${workspace_log}.
-
dtmland almost 9 yearsThe accepted answer below works for include paths in the project, but what about linked resource files? My generated makefile still contains absolute paths sources files. Do you not use linked sources in your project? How can you compile on other systems?
-
-
CashCow over 10 yearsRelative from where though?
-
dtmland almost 9 yearsBy chance do you how to achieve the same for linked source files? They are still being set to absolute in my generated makefiles?
-
Itamar Katz almost 9 yearsNo, sorry... I haven't worked with Eclipse in about 4 years.
-
huseyin tugrul buyukisik over 5 years.Same problem here. Linked resource, move project to another machine, it fails because of absolute path for linked resources (.h files).